A258572 Primes p such that p - 2, p^2 - 2, p^3 - 2, p^4 - 2 and p^5 - 2 are all prime.
15331, 3049201, 9260131, 10239529, 10955449, 24303469, 33491569, 42699721, 56341711, 66241561, 87068479, 114254629, 129783571, 143927419, 152065549, 221977909, 235529419, 252769399, 280028449, 284535481, 299116021, 312896359, 349665889, 361039519, 407462929
Offset: 1
Keywords
Programs
-
Magma
[p: p in PrimesUpTo(40000000) | IsPrime(p^1-2) and IsPrime(p^2-2) and IsPrime(p^3-2) and IsPrime(p^4-2) and IsPrime(p^5-2)];
-
Mathematica
Select[Prime[Range[10^8]], And@@PrimeQ[{#, # - 2, #^2 - 2, #^3 - 2, #^4 - 2, #^5 - 2}] &] (* Vincenzo Librandi, Jul 06 2015 *) Select[Prime[Range[2172*10^4]],AllTrue[#^Range[5]-2,PrimeQ]&] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Dec 02 2018 *)
-
PARI
first(m)=my(v=vector(m),i,p,t=1);for(i=1,m,while(1,p=prime(t);if(isprime(p-2)&&isprime(p^2 - 2)&&isprime(p^3 - 2)&&isprime(p^4 - 2)&&isprime(p^5 - 2),v[i]=p;break,t++));t++);v; /* Anders Hellström, Jul 17 2015 */
Extensions
a(10) corrected and a(14)-a(25) added by Giovanni Resta, Jun 05 2015
Comments