login
A344792
a(n) is half the n-th term of a truncated sesquinary (base 3/2) tree.
3
1, 4, 2, 6, 10, 3, 13, 9, 22, 15, 121, 7, 5, 67, 20, 31, 14, 33, 76, 34, 23, 409, 182, 16, 11, 40, 8, 151, 101, 30, 46, 70, 47, 21, 49, 112, 50, 114, 172, 51, 175, 52, 35, 1381, 614, 273, 616, 24, 37, 25, 17, 60, 91, 12, 19, 340, 227, 769, 152, 45, 103, 69, 157
OFFSET
1,2
COMMENTS
The tree is created by planting a tree with alternating branching and nonbranching nodes (as described in A005428). The nodes are then labeled in order -- 1,2,3,4,... All odd nodes are removed, leaving an infinite binary tree of every even number. Finally, each node is divided by two. The first four rows of the resultant tree are as follows:
1
4 2
6 10 3 13
9 22 15 121 7 5 67 20
...
The first number of the n-th row, a(2^(n-1)), is A081614(n). The last number of the n-th row is A182459(n). The lowest number of the n-th row is A061419(n). It appears that when n is even, A189706(a(n)+1) = 0, and when n is odd A189706(a(n)+1) = 1. This is true for at least the first n = 1 through 40000.
MAPLE
a:= proc(n) option remember;
a(iquo(n, 2))*3 + irem(n, 2);
while %::odd do ceil(% * 3/2) od; %/2
end: a(1):=1:
seq(a(n), n=1..63); # Alois P. Heinz, May 29 2021
MATHEMATICA
a[n_] := a[n] = Module[{t}, t = a[Quotient[n, 2]]*3 + Mod[n, 2];
While[OddQ[t], t = Ceiling[t * 3/2] ]; t/2]; a[1] = 1;
Table[a[n], {n, 1, 63}] (* Jean-François Alcover, Apr 14 2022, after Alois P. Heinz *)
PROG
(Java) See Links.
(PARI) a(n) = my(t=1); forstep(i=logint(n, 2)-1, 0, -1, t=3*t+1+bittest(n, i); my(k=valuation(t, 2)); t=(t*3^k)>>(k+1)); t; \\ Kevin Ryde, May 29 2021
CROSSREFS
Inverse is A345671.
Sequence in context: A134239 A136390 A019610 * A058613 A053227 A083760
KEYWORD
nonn,look
AUTHOR
John-Vincent Saddic, May 28 2021
STATUS
approved