OFFSET
1,1
COMMENTS
Also known as the Collatz Problem, Syracuse Algorithm or Hailstone Problem. Let syr(m,n) be the image of n at the m-th step. for m=2, k>=0 we get: syr(2,4k)=k, syr(2,4k+1)=6k+2, syr(2,4k+2)=6k+4, syr(2,4k+3)=6k+5.
REFERENCES
David Wells, Penguin Dictionary of Curious and Interesting Numbers
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
Eric Weisstein's World of Mathematics, Collatz Problem
Index entries for linear recurrences with constant coefficients, signature (0,0,0,2,0,0,0,-1).
FORMULA
G.f.: x*(x^6 +2*x^5 +4*x^4 +x^3 +5*x^2 +4*x +2)/(1-x^4)^2.
a(n) = (6*n +(55*n+4)*m -6*(5*n-2)*m^2 +(5*n-4)*m^3)/24, m=(n mod 4). - Zak Seidov, Sep 14 2006
From Federico Provvedi, Oct 17 2021: (Start)
Dirichlet g.f.: ((3*4^s - 10)*zeta(s-1) + (4^s + 2^s - 2)*zeta(s))/2^(2s+1).
a(n) = (n*(19-5*i^(2*n)) - (5*n+4)*(i^n + (-i)^n) + 8)/16, where i*i = -1. (End)
a(n) = 2*a(n-4) - a(n-8). - Wesley Ivan Hurt, Apr 16 2023
EXAMPLE
1->4->2, 2->1->4, 3->10->5, 4->2->1, ...
MATHEMATICA
Table[Nest[If[EvenQ[#], #/2, 3#+1]&, n, 2], {n, 80}] (* Harvey P. Dale, Nov 15 2012 *)
PROG
(PARI) x='x+O('x^80); Vec(x*(x^6+2*x^5+4*x^4+x^3+5*x^2+4*x+2)/(1-x^4)^2) \\ G. C. Greubel, Oct 16 2018
(Magma) m:=80; R<x>:=PowerSeriesRing(Integers(), m); Coefficients(R!(x*(x^6+2*x^5+4*x^4+x^3+5*x^2+4*x+2)/(1-x^4)^2));
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Bruce Corrigan (scentman(AT)myfamily.com), Oct 16 2002
STATUS
approved