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, 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
Keywords
Examples
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.
Links
- Adrian Rusu, Tree Drawing Algorithms, Rowan University.
- Eric Weisstein's World of Mathematics, Complete Binary Tree.
Crossrefs
Cf. A032924.
Programs
-
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}]
Comments