%I A114567
%S A114567 1,3,1,5,1,5,1,7,1,3,1,7,1,7,1,9,1,3,1,7,1,7,1,9,1,3,1,9,1,9,1,11,1,3,
1,
%T A114567 5,1,5,1,9,1,3,1,9,1,9,1,11,1,3,1,9,1,9,1,11,1,3,1,11,1,11,1,13,1,3,1,
5,
%U A114567 1,5,1,9,1,3,1,9,1,9,1,11,1,3,1,9,1,9,1,11,1,3,1,11,1,11,1,13,1,3,1,5,
1
%N A114567 a_n = k such that the binary expansion of n mod 2^k is the postorder
traversal of a binary tree, where 1 indicates a node and 0 indicates
there are no children on that side.
%C A114567 Postorder traversals of a binary tree form an instantaneous code; any
integer has a unique decomposition into codewords. To get the first
codeword, find a_n. Then set n'=floor[n/2^(a_n)], find a_n' and so
on.
%F A114567 a_n = 1 if n even a_n = 1 + a_{floor[n/2]} + a_{floor[n/2^{a_{floor[n/
2]}+1}]} if n odd
%e A114567 a_37 = 1 + a_{floor[37/2]} + a_{floor[37/2^{a_{floor[37/2]}+1}]}
%e A114567 = 1 + a_18 + a_{floor[37/2^{a_18+1}]}
%e A114567 = 1 + 1 + a_{floor[37/2^{1+1}]}
%e A114567 = 2 + a_9
%e A114567 = 2 + 1 + a_{floor[9/2]} + a_{floor[9/2^{a_{floor[9/2]}+1}]}
%e A114567 = 3 + a_4 + a_{floor[9/2^{a_4+1}]}
%e A114567 = 3 + 1 + a_{floor[9/4]}
%e A114567 = 4 + a_2
%e A114567 = 5
%e A114567 37 mod 2^5 = 5 = 00101 which is the postorder traversal of the binary
tree with a root node and a single left child.
%t A114567 T:=If[Mod[ #,2]==0,1,1+T[Floor[ #/2]]+T[Floor[ #/2^(T[Floor[ #/2]]+1)]]]&
%Y A114567 Sequence in context: A037227 A056753 A154723 this_sequence A001051 A046730
A002972
%Y A114567 Adjacent sequences: A114564 A114565 A114566 this_sequence A114568 A114569
A114570
%K A114567 easy,nonn
%O A114567 0,2
%A A114567 Michael Stay (metaweta(AT)gmail.com), Feb 15 2006
|