|
|
A183209
|
|
Tree generated by floor(3n/2): a(1) = 1, a(2n) = (3*a(n))-1, a(2n+1) = floor((3*a(n+1))/2).
|
|
8
|
|
|
1, 2, 3, 5, 4, 8, 7, 14, 6, 11, 12, 23, 10, 20, 21, 41, 9, 17, 16, 32, 18, 35, 34, 68, 15, 29, 30, 59, 31, 62, 61, 122, 13, 26, 25, 50, 24, 47, 48, 95, 27, 53, 52, 104, 51, 101, 102, 203, 22, 44, 43, 86, 45, 89, 88, 176, 46, 92, 93, 185, 91, 182, 183, 365, 19, 38, 39, 77, 37
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
A permutation of the positive integers. See the comment at A183079. Leftmost branch of tree is essentially A061418. Rightmost: A007051.
|
|
LINKS
|
|
|
FORMULA
|
Let L(n)=floor(3n/2).
Let U(n)=3n-1. U is the complement of L.
The tree-array T(n,k) is then given by rows:
T(0,0)=1; T(1,0)=2;
T(n,2j)=L(T(n-1),j);
T(n,2j+1)=U(T(n-1),j);
for j=0,1,...,2^(n-1)-1, n>=2.
a(1) = 1, a(2n) = (3*a(n))-1, a(2n+1) = A032766(a(n+1)) = floor((3*a(n+1))/2).
Other identities:
(End)
|
|
EXAMPLE
|
First levels of the tree:
1
2
3 5
4 8 7 14
|
|
MAPLE
|
f:= proc(n) option remember;
if n::even then 3*procname(n/2)-1
else floor(3*procname((n+1)/2)/2)
fi
end proc:
f(1):= 1:
|
|
MATHEMATICA
|
a[1]=1; a[n_] := a[n] = If[EvenQ[n], 3a[n/2]-1, Floor[3a[(n+1)/2]/2] ]; Array[a, 100] (* Jean-François Alcover, Feb 02 2018 *)
|
|
PROG
|
(Scheme, with memoizing macro definec)
(Haskell)
import Data.List (transpose)
a183209 n k = a183209_tabf !! (n-1) !! (k-1)
a183209_row n = a183209_tabf !! (n-1)
a183209_tabf = [1] : iterate (\xs -> concat $
transpose [map a032766 xs, map (a016789 . subtract 1) xs]) [2]
a183209_list = concat a183209_tabf
(Python)
def a(n):
if n==1: return 1
if n%2==0: return 3*a(n//2) - 1
else: return (3*a((n - 1)//2 + 1))//2
|
|
CROSSREFS
|
|
|
KEYWORD
|
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|