login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Additive terms of the rational Collatz tree.
1

%I #17 Aug 26 2015 12:55:53

%S 0,1,2,4,4,5,8,13,8,7,10,14,16,17,26,40,16,11,14,16,20,19,28,41,32,25,

%T 34,44,52,53,80,121,32,19,22,20,28,23,32,43,40,29,38,46,56,55,82,122,

%U 64,41,50,52,68,61,88,125,104,79,106,134

%N Additive terms of the rational Collatz tree.

%C A full binary tree can be constructed by inverting the Collatz function and removing the even and odd branch conditions. The rational numbers formed by this tree have the form c = ((2^x + a(n))/(3^y)) where (y = A000120(n)) and (x >= A029837(c+1)-y).

%H Charles R Greathouse IV, <a href="/A261393/b261393.txt">Table of n, a(n) for n = 0..10000</a>

%F a(0) = 0, a(2*n) = 2*a(n), and a(2*n+1) = a(n) + 3^A000120(n).

%e a(0) = 0.

%e a(1) = a(2*0+1) = a(0) + 3^A000120(0) = 0 + 3^0 = 1.

%e a(2) = a(2*1) = 2*a(1) = 2*1 = 2.

%e a(3) = a(2*1+1) = a(1) + 3^A000120(1) = 1 + 3^1 = 4.

%e a(4) = a(2*2) = 2*a(2) = 2*2 = 4.

%e a(5) = a(2*2+1) = a(2) + 3^A000120(2) = 2 + 3^1 = 5.

%e a(6) = a(2*3) = 2*a(3) = 2*4 = 8.

%e a(7) = a(2*3+1) = a(3) + 3^A000120(3) = 4 + 3^2 = 13.

%e a(8) = a(2*4) = 2*a(4) = 2*4 = 8.

%o (Python)

%o def h(n):

%o if(n == 0): return 0

%o elif(n%2 == 0): return h(n/2)

%o else: return h((n-1)/2) + 1

%o def a(n):

%o if(n == 0): return 0

%o elif(n%2 == 0): return 2*a(n/2)

%o else: return a((n-1)/2) + 3**h((n-1)/2)

%o (PARI) h(n)=if(n,n>>=valuation(n,2);h(n\2)+1,0)

%o a(n)=if(n,my(k=valuation(n,2));n>>=k+1;(a(n)+3^h(n))<<k,0) \\ _Charles R Greathouse IV_, Aug 18 2015

%Y Cf. A000120, A029837.

%K nonn,easy

%O 0,3

%A _Jared Deckard_, Aug 17 2015