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
KEYWORD
nonn
AUTHOR
Frank M Jackson, Nov 12 2014
STATUS
approved