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!)
A066745 Least number of applications of f(k) = k(k+1)+1 to n to yield a prime, if this number exists; -1 otherwise. 0
2, 1, 0, 0, 2, 0, 1, 0, 1, 3, 2, 0, 1, 0, 1, 1 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,1
COMMENTS
a(16) >= 18 (unless a(16) = -1). - Pontus von Brömssen, Apr 22 2023
LINKS
FORMULA
From Pontus von Brömssen, Apr 22 2023: (Start)
a(n) = 0 if n is prime, otherwise a(n) = 1 + a(n*(n+1)+1) (unless a(n) = -1).
a(n) is even if and only if (a) n = 0, (b) n is prime, or (c) n == 1 (mod 3), n >= 4, and a(n) != -1. This can be seen by considering how f maps the residue classes modulo 3: 2 -> 1 -> 0 -> 1.
(End)
EXAMPLE
f(f(f(9))) = f(f(91)) = f(8373) = 70115503, a prime, whereas 9, 91, 8373 are composite; so a(9) = 3.
MATHEMATICA
Table[Length[NestWhileList[#(#+1)+1&, n, !PrimeQ[#]&, 1, 20]]-1, {n, 0, 15}] (* Arbitrary maximum of 20 iterations of the function set. *) (* Harvey P. Dale, Apr 19 2023 *)
CROSSREFS
Sequence in context: A335021 A176202 A040081 * A239393 A256637 A113063
KEYWORD
nonn,more
AUTHOR
Joseph L. Pe, Jan 16 2002
EXTENSIONS
a(0) prepended by Pontus von Brömssen, Apr 22 2023
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 April 24 16:56 EDT 2024. Contains 371962 sequences. (Running on oeis4.)