login
A274472
Number of iterations of the Collatz recursion required to reach a prime number.
3
2, 0, 0, 1, 0, 1, 0, 2, 3, 1, 0, 2, 0, 1, 2, 3, 0, 4, 0, 2, 6, 1, 0, 3, 3, 1, 2, 2, 0, 3, 0, 4, 6, 1, 2, 5, 0, 1, 2, 3, 0, 7, 0, 2, 4, 1, 0, 4, 3, 4, 6, 2, 0, 3, 2, 3, 3, 1, 0, 4, 0, 1, 17, 5, 6, 7, 0, 2, 5, 3, 0, 6, 0, 1, 2, 2, 4, 3, 0, 4, 3, 1, 0, 8, 8, 1, 2
OFFSET
1,1
COMMENTS
If n is prime then a(n)=0. If n is composite then a(n)=A280929(n). - Dmitry Kamenetsky, Jan 11 2017
MATHEMATICA
Table[Length@ NestWhileList[If[EvenQ@ #, #/2, 3 # + 1] &, n, ! PrimeQ@ # &] - 1, {n, 120}] (* Michael De Vlieger, Jun 26 2016 *)
PROG
(PARI) a(n) = my(i=0, k=n); while(!ispseudoprime(k), if(k%2==0, k=k/2, k=3*k+1); i++); i
for(n=1, 87, print1(a(n), ", ")) \\ Felix Fröhlich, Jun 24 2016
CROSSREFS
KEYWORD
nonn
AUTHOR
Matthew Campbell, Jun 24 2016
EXTENSIONS
More terms from Felix Fröhlich, Jun 24 2016
STATUS
approved