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

A309154
Function of natural numbers satisfying the properties a(2*n) = 2*a(n) and a(2*n+1) = -3 + 2*a(3*n+2).
1
0, 1, 2, 23, 4, 13, 46, 1595, 8, 6377, 26, 799, 92, 101, 3190, 3283, 16, 401, 12754, 12775, 52, 61, 1598, 1643, 184, 51097, 202, 946891009738223808271, 6380, 6389, 6566, 118361376217277976035, 32, 204385, 802, 823, 25508, 25517, 25550, 6540635, 104, 473445504869111904137
OFFSET
0,3
COMMENTS
This integer sequence exists if and only if the Collatz conjecture is true. The proof is relatively trivial.
This is -3 times the Q function from Rozier restricted to the natural numbers.
The only multiple of 3 in the sequence is 0.
FORMULA
a(2*n) = 2*a(n); a(2*n+1) = -3 + 2*a(3*n+2).
a(n) = -3*(n mod 2) + 2*a(A014682(n)) where A014682 is the Collatz function.
EXAMPLE
For n = 0, the equation a(0) = 2*a(0) implies a(0) = 0.
For n = 1, the equation becomes a(1) = -3 + 2*a(2) = -3 + 4*a(1), so a(1) = 1.
For n = 3, a bit more calculating gives a(3) = -3 + 2*a(5) = -9 + 4*a(8) = -9 + 32*a(1) = 23.
MAPLE
a:= proc(n) option remember; `if`(n<2, n,
`if`(irem(n, 2, 'r')=0, 2*a(r), 2*a(n+r+1)-3))
end:
seq(a(n), n=0..40); # Alois P. Heinz, Jul 14 2019
MATHEMATICA
a[n_] := a[n] = If[n < 2, n, If[EvenQ[n], 2 a[n/2], 2 a[(3n + 1)/2] - 3]];
a /@ Range[0, 50] (* Jean-François Alcover, Sep 28 2019 *)
PROG
(Python)
def a(x):
if x <= 1: return x
elif x%2: return -3 + 2 * a((3*x + 1)//2)
else: return 2*a(x//2)
(PARI) a(n)=if(n<=1, n, if(n%2, -3 + 2*a((3*n+1)/2), 2*a(n/2))) \\ Richard N. Smith, Jul 16 2019
CROSSREFS
Cf. A014682.
Sequence in context: A245628 A162711 A120713 * A167920 A237579 A104644
KEYWORD
easy,nonn
AUTHOR
Jan Met den Ancxt, Jul 14 2019
STATUS
approved