login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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 (list; graph; refs; listen; history; text; internal format)
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
LINKS
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
Sequence in context: A256572 A025463 A327686 * A283669 A220945 A089224
KEYWORD
nonn
AUTHOR
Matthew Campbell, Jun 24 2016
EXTENSIONS
More terms from Felix Fröhlich, Jun 24 2016
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified July 5 15:18 EDT 2024. Contains 374026 sequences. (Running on oeis4.)