OFFSET
1,1
COMMENTS
6 is in the sequence because the following are six primes: 71, 73, 107, 109, 179, 181.
MATHEMATICA
spQ[n_]:=AllTrue[Flatten[{2n^2+{1, -1}, 3n^2+{1, -1}, 5n^2+{1, -1}}], PrimeQ]; Select[ Range[101*10^6], spQ] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Jan 28 2015 *)
PROG
(Java)
import java.math.BigInteger;
public class A226461 {
public static void main (String[] args) {
for (long n = 1; n < (1L << 30); n++)
long x = n*n*5;
BigInteger b = BigInteger.valueOf(x+1);
if (!b.isProbablePrime(80)) continue;
b = BigInteger.valueOf(x-1);
if (!b.isProbablePrime(80)) continue;
x = n*n*2;
b = BigInteger.valueOf(x+1);
if (!b.isProbablePrime(80)) continue;
b = BigInteger.valueOf(x-1);
if (!b.isProbablePrime(80)) continue;
x = n*n*3;
b = BigInteger.valueOf(x+1);
if (!b.isProbablePrime(80)) continue;
b = BigInteger.valueOf(x-1);
if (!b.isProbablePrime(80)) continue;
System.out.printf("%d, ", n);
}
}
}
CROSSREFS
KEYWORD
nonn
AUTHOR
Alex Ratushnyak, Jun 08 2013
STATUS
approved