A204065 Least nonnegative integer k with n+k and n+k^2 both prime.
1, 0, 0, 1, 0, 1, 0, 3, 2, 1, 0, 1, 0, 3, 2, 1, 0, 1, 0, 3, 16, 1, 0, 7, 4, 15, 2, 1, 0, 1, 0, 9, 8, 3, 6, 1, 0, 3, 2, 1, 0, 1, 0, 3, 8, 1, 0, 5, 10, 3, 10, 1, 0, 5, 4, 15, 2, 1, 0, 1, 0, 21, 4, 3, 6, 1, 0, 15, 2, 1, 0, 1, 0, 33, 8, 25, 6, 1, 0, 3, 16, 1, 0, 5, 4, 15, 14, 1, 0, 7, 6, 9, 4, 3, 6, 1, 0, 3, 2, 1
Offset: 1
Keywords
Examples
a(8)=3 since 8+3 and 8+3^2 are both prime, but none of 8, 8+1, 8+2 is prime.
Links
- Zhi-Wei Sun, Table of n, a(n) for n = 1..10000
- Zhi-Wei Sun, Conjectures involving primes and quadratic forms, arXiv:1211.1588.
Programs
-
Mathematica
Do[Do[If[PrimeQ[n+k]==True&&PrimeQ[n+k^2]==True,Print[n," ",k];Goto[aa]],{k,0,n}]; Label[aa];Continue,{n,1,100}]
-
PARI
a(n)=my(k=0); while(!isprime(n+k) || !isprime(n+k^2), k++); k \\ - M. F. Hasler, Jan 11 2013
Comments