

A299691


Smallest prime p that remains prime through exactly n iterations of the function f(x) = (x^2 + 7)/8.


0




OFFSET

0,1


COMMENTS

Since f(7) = (7^2 + 7)/8 = 7, p=7 remains prime through infinitely many iterations of the function.


LINKS

Table of n, a(n) for n=0..5.


EXAMPLE

f(2) = (2^2 + 7)/8 = 11/8 (not a prime), and 2 is the smallest prime, so a(0) = 2.
f(3) = (3^2 + 7)/8 = 16/8 = 2 (prime), but (2^2 + 7)/8 = 11/8 (not a prime), so p remains prime through exactly one iteration, and p=3 is the smallest prime for which this is the case, so a(1) = 3.
f(89) = (89^2 + 7)/8 = 991 (prime), and f(991) = (991^2 + 7)/8 = 122761 (prime), but f(122761) = (122761^2 + 7)/8 = 1883782891 = 211 * 8927881 (not a prime), so p remains prime through exactly two iterations, and p=89 is the smallest prime for which this is the case, so a(2) = 89.


MATHEMATICA

Block[{lim = 10^2, s}, s = Array[Length@ NestWhileList[(#^2 + 7)/8 &, Prime@ #, PrimeQ, 1, lim, 1] /. lim > 0 &, 10^6]; Array[Prime@ FirstPosition[s, #][[1]] &, Max@ s]] (* Michael De Vlieger, Feb 18 2018 *)


PROG

(PARI) isprimeq(q) = {if (denominator(q) != 1, return (0)); isprime(q); }
isok(p, n) = {for (k=1, n, q = (p^2 + 7)/8; if (! isprimeq(q), return (0)); p = q; ); q = (p^2 + 7)/8; return (! isprimeq(q)); }
a(n) = {forprime(p=2, , if (isok(p, n), return (p)); ); } \\ Michel Marcus, Feb 26 2018


CROSSREFS

Cf. A118940 (Primes p such that (p^2 + 7)/8 is prime).
Sequence in context: A103013 A246121 A224934 * A042901 A002983 A118167
Adjacent sequences: A299688 A299689 A299690 * A299692 A299693 A299694


KEYWORD

nonn,hard,more


AUTHOR

Jon E. Schoenfield, Feb 16 2018


STATUS

approved



