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”).

A261393
Additive terms of the rational Collatz tree.
1
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, 34, 44, 52, 53, 80, 121, 32, 19, 22, 20, 28, 23, 32, 43, 40, 29, 38, 46, 56, 55, 82, 122, 64, 41, 50, 52, 68, 61, 88, 125, 104, 79, 106, 134
OFFSET
0,3
COMMENTS
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).
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 0..10000
FORMULA
a(0) = 0, a(2*n) = 2*a(n), and a(2*n+1) = a(n) + 3^A000120(n).
EXAMPLE
a(0) = 0.
a(1) = a(2*0+1) = a(0) + 3^A000120(0) = 0 + 3^0 = 1.
a(2) = a(2*1) = 2*a(1) = 2*1 = 2.
a(3) = a(2*1+1) = a(1) + 3^A000120(1) = 1 + 3^1 = 4.
a(4) = a(2*2) = 2*a(2) = 2*2 = 4.
a(5) = a(2*2+1) = a(2) + 3^A000120(2) = 2 + 3^1 = 5.
a(6) = a(2*3) = 2*a(3) = 2*4 = 8.
a(7) = a(2*3+1) = a(3) + 3^A000120(3) = 4 + 3^2 = 13.
a(8) = a(2*4) = 2*a(4) = 2*4 = 8.
PROG
(Python)
def h(n):
if(n == 0): return 0
elif(n%2 == 0): return h(n/2)
else: return h((n-1)/2) + 1
def a(n):
if(n == 0): return 0
elif(n%2 == 0): return 2*a(n/2)
else: return a((n-1)/2) + 3**h((n-1)/2)
(PARI) h(n)=if(n, n>>=valuation(n, 2); h(n\2)+1, 0)
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
CROSSREFS
Sequence in context: A344710 A184615 A151969 * A366541 A327629 A121528
KEYWORD
nonn,easy
AUTHOR
Jared Deckard, Aug 17 2015
STATUS
approved