login
a(n) = binary code (shown here in decimal) of the position of natural number n in the beanstalk-tree A218778.
4

%I #16 Mar 28 2014 23:43:25

%S 1,2,3,5,7,9,13,21,29,37,53,69,101,85,117,181,245,309,437,565,821,693,

%T 949,1205,1717,1461,1973,2741,3765,2485,3509,5557,7605,9653,13749,

%U 17845,26037,21941,30133,38325,54709,46517,62901,87477,120245,79285,112053,144821

%N a(n) = binary code (shown here in decimal) of the position of natural number n in the beanstalk-tree A218778.

%C The binary code is the same as used by function general-car-cdr of MIT/GNU Scheme: a zero bit represents a cdr operation (taking the right hand side branch in the binary tree), and a one bit represents a car (taking the left hand side branch in the binary tree). The bits are interpreted from LSB to MSB, and the most significant one bit, rather than being interpreted as an operation, signals the end of the binary code.

%H A. Karttunen, <a href="/A218614/b218614.txt">Table of n, a(n) for n = 1..1024</a>

%H MIT/GNU Scheme 9.1. documentation, <a href="http://www.gnu.org/software/mit-scheme/documentation/mit-scheme-ref/Pairs.html#index-general_002dcar_002dcdr-1159">Function general-car-cdr</a>

%F a(1)=1; for even n, a(n) = A004754(a(A011371(n))); for odd n, a(n) = A004755(a(A011371(n))).

%e As we must traverse to 4 in A218778-tree (see the example there) by first taking the left branch (car) from the root, resulting bit 1 as the least significant bit of the code, then by taking the right branch (cdr) from 3 to get to 4, resulting bit 0 as the second rightmost bit of the code, which when capped with an extra termination-one, results binary code 101, 5 in decimal, thus a(4)=5.

%o (Scheme with memoization macro definec): (definec (A218614 n) (cond ((< n 2) n) ((even? n) (A004754 (A218614 (A011371 n)))) (else (A004755 (A218614 (A011371 n))))))

%Y a(n) = A054429(A218615(n)). Superset of A218790. Used to construct A218778, A218779. Cf. also A218787, A218788

%K nonn,base

%O 1,2

%A _Antti Karttunen_, Nov 16 2012