OFFSET
0,2
COMMENTS
It is interesting to note that the quantity 3^k + 1 appears in the formula: A006577(n + 2^A006666(n)) = A006577(n) + A006577(1 + 3^A006667(n)) where A006577 is the n number of halving and tripling steps to reach 1 in '3x+1' problem, A006666 is the number of halving steps to reach 1 and A006667 the number of tripling steps to reach 1.
LINKS
Harvey P. Dale, Table of n, a(n) for n = 0..1000
Wikipedia, Collatz conjecture
FORMULA
a(n) = A075487(n) - 1.
EXAMPLE
a(2) = 6 because 3^2 + 1 = 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1 with 6 iterations.
MATHEMATICA
f[n_] := Module[{a=3^n+1, k=0}, While[a!=1, k++; If[EvenQ[a], a=a/2, a=a*3+1]]; k]; Table[f[n], {n, 100}]
Table[Length[NestWhileList[If[EvenQ[#], #/2, 3#+1]&, 3^n+1, #!=1&]]-1, {n, 0, 60}] (* Harvey P. Dale, Sep 26 2015 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Michel Lagneau, Feb 14 2013
STATUS
approved