OFFSET
1,1
COMMENTS
I.e., primes p for which the difference between p^2 and the square of the next prime is the average of a twin prime pair.
EXAMPLE
The primes 7 and 11 are consecutive and their squares are 49 and 121. The difference is 72, and both 71 and 73 are prime.
Likewise, the difference between the square of 563 and the next prime (569) is 6792, and 6791 and 6793 are twin primes.
MATHEMATICA
For[p = 1, p < 10000, p++,
a = Prime[p];
b = Prime[p + 1];
c = b^2 - a^2;
d = (c + 1);
e = (c - 1);
If[And[PrimeQ[d] == True, PrimeQ[e] == True], Print[a]];
]
(* Second program: *)
Select[Partition[Prime@ Range@ 300, 2, 1], AllTrue[{# + 1, # - 1}, PrimeQ] &[#2^2 - #1^2] & @@ # &][[All, 1]] (* Michael De Vlieger, Dec 03 2017 *)
PROG
(PARI) lista(nn) = { my(pp=2); forprime(p=3, nn, my(d=p^2-pp^2); if(isprime(d+1) && isprime(d-1), print1(pp, ", ")); pp=p); } \\ Iain Fox, Dec 03 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Geoffrey Marnell, Nov 25 2017
STATUS
editing