login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A245905 Zero followed by the terms of A023705 arranged to give the unique path to the n-th node of a complete, rooted and ordered ternary tree. 0
0, 1, 2, 3, 5, 9, 13, 6, 10, 14, 7, 11, 15, 21, 37, 53, 25, 41, 57, 29, 45, 61, 22, 38, 54, 26, 42, 58, 30, 46, 62, 23, 39, 55, 27, 43, 59, 31, 47, 63, 85, 149, 213, 101, 165, 229, 117, 181, 245, 89, 153, 217, 105, 169, 233, 121, 185, 249, 93, 157, 221, 109, 173, 237, 125, 189, 253 (list; graph; refs; listen; history; text; internal format)
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 A023705 that are base 4 numbers containing no zeros. Starting at the lowest order digit base 4, if this is 1 then the path from the root node is to the left, if it is 2 straight on and if it is 3 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 Ternary Tree.
EXAMPLE
a(33)=39, so the path to the 33rd node is given by 39 and when represented as the base 4 number gives 213. Hence the path to the 33rd node from the root node is Right, Left, Straight.
MATHEMATICA
tree=3; nest[{m2_, p2_}] := If[(mod=Mod[m2, tree])>1, (ind=mod-1; {(m2+tree-mod)/tree, ind+p2*(tree+1)}), (ind=tree+mod-1; {(m2-mod)/tree, ind+p2*(tree+1)})]; Table[NestWhile[nest, {n, 0}, #[[1]]!=1 &][[2]], {n, 1, 100}]
CROSSREFS
Cf. A023705.
Sequence in context: A079741 A000861 A108168 * A366482 A087146 A033945
KEYWORD
nonn
AUTHOR
Frank M Jackson, Nov 13 2014
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified July 12 14:24 EDT 2024. Contains 374251 sequences. (Running on oeis4.)