%I #19 Apr 30 2021 07:53:47
%S 0,2,10,12,42,50,52,56,170,202,210,226,212,228,232,240,682,810,842,
%T 906,850,914,930,962,852,916,932,964,936,968,976,992,2730,3242,3370,
%U 3626,3402,3658,3722,3850,3410,3666,3730,3858,3746,3874,3906,3970,3412,3668,3732,3860,3748,3876,3908,3972,3752,3880,3912,3976,3920,3984,4000,4032
%N A014486-codes for rooted plane trees where non-leaf branching can occur only at the leftmost branch of any level, but nowhere else. Reflected from the corresponding rightward branching codes in A071162, thus not in ascending order.
%C Like with A071162, a(n) can be computed directly from the binary expansion of n. (See the Scheme function given). However, the function is not monotone. A209641 gives the same terms in ascending order.
%H Antti Karttunen, <a href="/A209642/b209642.txt">Table of n, a(n) for n = 0..32767</a>
%F a(n) = A056539(A071162(n)) = A036044(A071162(n)). (See also the given Scheme-function).
%o (Scheme) (define (A209642 n) (let loop ((n n) (s 0) (i 1)) (cond ((zero? n) s) ((even? n) (loop (/ n 2) (+ (* 4 s) 1) (* i 4))) (else (loop (/ (- n 1) 2) (* 2 (+ s i)) (* i 4))))))
%o (Python)
%o def a(n):
%o s=0
%o i=1
%o while n!=0:
%o if n%2==0:
%o n//=2
%o s=4*s + 1
%o else:
%o n=(n - 1)//2
%o s=(s + i)*2
%o i*=4
%o return s
%o print([a(n) for n in range(101)]) # _Indranil Ghosh_, May 25 2017, translated from _Antti Karttunen_'s SCHEME code
%Y a(n) = A209641(A209861(n)).
%K nonn,easy
%O 0,2
%A _Antti Karttunen_, Mar 11 2012