A231332 Primes p = prime(k) such that p - 2k and p + 2k are prime.
17, 23, 37, 89, 113, 151, 307, 463, 557, 643, 701, 761, 863, 911, 977, 1019, 1069, 1093, 1427, 1481, 1733, 1867, 2521, 2687, 2731, 2753, 3163, 3221, 3581, 3623, 3877, 4139, 4243, 4621, 4643, 4783, 4861, 4889, 4937, 5443, 5569, 5807, 5903, 6619, 6701, 6761, 6871
Offset: 1
Keywords
Examples
17 is the seventh prime, and 17 - 2 * 7 = 3 and 17 + 2 * 7 = 31, both of which are prime, so 17 is in the sequence. 23 is the ninth prime, and 23 - 2 * 9 = 5 and 23 + 2 * 9 = 41, both of which are prime, so 23 is in the sequence. 29 is the tenth prime, and 29 - 2 * 10 = 9 and 29 + 2 * 10 = 49, neither of which is prime, so 29 is not in the sequence.
Links
- Zak Seidov, Table of n, a(n) for n = 1..1000
Programs
-
Mathematica
Reap[Sow[17]; Do[p = Prime[k]; If[PrimeQ[p + 2 * k] && PrimeQ[p - 2 * k], Sow[p]], {k, 9, 10^3, 3}]][[2, 1]] Select[Table[{n, Prime[n]},{n,1000}],AllTrue[#[[2]]+{2#[[1]],-2#[[1]]},PrimeQ]&][[All,2]] (* Harvey P. Dale, Aug 05 2022 *)
-
PARI
{print(17","); forstep(k=9,885,3,p=prime(k);if(isprime(p+2*k)&& isprime(p-2*k),print(p",")))}
-
PARI
k=0;forprime(p=2,1e6,k++;if(isprime(p-2*k) && isprime(2+2*k), print1(p", "))) \\ Charles R Greathouse IV, Jan 07 2014
Comments