The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
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!)
A285700 a(n) = Number of iterations x -> 2x-1 needed to get a nonprime number, when starting with x = n. 3
0, 3, 2, 0, 1, 0, 2, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
LINKS
FORMULA
If A010051(n) = 0 [when n is a nonprime], a(n) = 0, otherwise a(n) = 1 + a((2*n)-1).
a(A000040(n)) = A181715(n).
MATHEMATICA
Array[Length@ NestWhileList[2 # - 1 &, #, PrimeQ@ # &] - 1 &, 120] (* Michael De Vlieger, Apr 26 2017 *)
PROG
(Scheme) (define (A285700 n) (if (zero? (A010051 n)) 0 (+ 1 (A285700 (+ n n -1)))))
(Python)
from sympy import isprime
def a(n): return 0 if isprime(n) == 0 else 1 + a(2*n - 1) # Indranil Ghosh, Apr 26 2017
CROSSREFS
Cf. A000040, A005382 (positions of terms > 1), A010051, A181715, A285701.
Sequence in context: A144553 A187130 A187145 * A290693 A131290 A138741
KEYWORD
nonn
AUTHOR
Antti Karttunen, Apr 26 2017
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 May 13 05:24 EDT 2024. Contains 372498 sequences. (Running on oeis4.)