A249573 Smallest prime p that remains prime through exactly n iterations of the function f(x) = 5x + 2.
2, 3, 13, 19, 373, 174877, 135859, 18235423, 26588257, 93112729, 376038903103, 7087694466289, 120223669028389
Offset: 0
Examples
With p = 13: 5 * 13 + 2 = 67, 5 * 67 + 2 = 337 and 5 * 337 + 2 = 1687. 67 and 337 are both prime, but 1687 is not, so 13 remains prime through exactly two iterations of 5 * x + 2 and is the smallest prime with this property, so a(2) = 13.
Programs
-
Mathematica
c[p_] := Block[{k = 1, q = 5*p+2}, While[ PrimeQ[q], q = 5*q+2; k++]; k]; a[n_] := Block[{p = 2}, While[c[p] != n, p = NextPrime@ p]; p]; Array[a, 7] (* Giovanni Resta, Mar 21 2017 *)
-
PARI
for(n=0, 10, forprime(p=2, 1e20, i=0; a=p; while(ispseudoprime(5*a+2), a=5*a+2; i++); if(i==n, print1(p, ", "); break(1))))
Extensions
a(10) from Charles R Greathouse IV, Jan 13 2017
a(11) from John Cerkan, Mar 20 2017
a(12) from Giovanni Resta, Mar 21 2017
Comments