login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A244591
Zero followed by the terms of A032924 arranged to give the unique path to the n-th node of a complete, rooted and ordered binary tree.
0
0, 1, 2, 4, 7, 5, 8, 13, 22, 16, 25, 14, 23, 17, 26, 40, 67, 49, 76, 43, 70, 52, 79, 41, 68, 50, 77, 44, 71, 53, 80, 121, 202, 148, 229, 130, 211, 157, 238, 124, 205, 151, 232, 133, 214, 160, 241, 122, 203, 149, 230, 131, 212, 158, 239, 125, 206, 152, 233, 134, 215, 161, 242, 364
OFFSET
1,3
COMMENTS
There is no path to the root node so first node path is 0. All other paths are represented by the terms of A032924 that are base 3 numbers containing no zeros. Starting at the lowest order digit base 3, if this is 1 then the path from the root node to a lower level node is to the left, otherwise it is to the right. Each successive digit order defines the next path to be taken until the highest digit order is reached and the specified node found.
LINKS
Adrian Rusu, Tree Drawing Algorithms, Rowan University.
Eric Weisstein's World of Mathematics, Complete Binary Tree.
EXAMPLE
a(11)=25, so the path to node 11 is given by 25 which when represented as a base 3 number gives 221. Hence the path to the 11th node from the root node is Left, Right, Right.
MATHEMATICA
nest[{m_, p_}] := (If[EvenQ[m], ind=1, ind=2]; {Floor[m/2], 3p+ind}); Table[NestWhile[nest, {n, 0}, #[[1]]!=1 &][[2]], {n, 1, 100}]
CROSSREFS
Cf. A032924.
Sequence in context: A073158 A035311 A182310 * A377351 A299324 A261076
KEYWORD
nonn
AUTHOR
Frank M Jackson, Nov 12 2014
STATUS
approved