|
|
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
|
|
|
LINKS
|
|
|
FORMULA
|
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
|
|
|
KEYWORD
|
nonn,more
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|