%I #59 Apr 14 2022 08:01:14
%S 1,4,2,6,10,3,13,9,22,15,121,7,5,67,20,31,14,33,76,34,23,409,182,16,
%T 11,40,8,151,101,30,46,70,47,21,49,112,50,114,172,51,175,52,35,1381,
%U 614,273,616,24,37,25,17,60,91,12,19,340,227,769,152,45,103,69,157
%N a(n) is half the n-th term of a truncated sesquinary (base 3/2) tree.
%C 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:
%C 1
%C 4 2
%C 6 10 3 13
%C 9 22 15 121 7 5 67 20
%C ...
%C 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.
%H Alois P. Heinz, <a href="/A344792/b344792.txt">Table of n, a(n) for n = 1..10000</a>
%H John-Vincent Saddic, <a href="/A344792/a344792.java.txt">Java code to produce the first n lines of the tree</a>
%H John-Vincent Saddic, <a href="/A344792/a344792_1.png">Diagram to construct the tree</a>
%H John-Vincent Saddic, <a href="/A344792/a344792_2.png">Log/log scatterplot</a>
%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%p a:= proc(n) option remember;
%p a(iquo(n, 2))*3 + irem(n, 2);
%p while %::odd do ceil(% * 3/2) od; %/2
%p end: a(1):=1:
%p seq(a(n), n=1..63); # _Alois P. Heinz_, May 29 2021
%t a[n_] := a[n] = Module[{t}, t = a[Quotient[n, 2]]*3 + Mod[n, 2];
%t While[OddQ[t], t = Ceiling[t * 3/2] ]; t/2]; a[1] = 1;
%t Table[a[n], {n, 1, 63}] (* _Jean-François Alcover_, Apr 14 2022, after _Alois P. Heinz_ *)
%o (Java) See Links.
%o (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
%Y Inverse is A345671.
%Y Cf. A005428, A081614, A182459, A061419, A189706.
%K nonn,look
%O 1,2
%A _John-Vincent Saddic_, May 28 2021