login
A295706
Primes p for which the difference between p^2 and the square of the next prime is both 1 more and 1 less than a prime.
1
7, 17, 23, 37, 47, 59, 83, 89, 107, 113, 127, 131, 149, 163, 173, 257, 353, 433, 439, 457, 467, 521, 563, 761, 773, 839, 881, 953, 1009, 1031, 1213, 1307, 1319, 1321, 1697, 1733, 1759, 1811, 1861, 1871, 1913, 1979, 2153, 2221, 2281, 2287, 2309, 2393, 2593, 2767, 2789
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.
LINKS
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.
MAPLE
N:= 10^4: # to get all terms <= N
p:= 1: q:= 2: A:= NULL:
while p < N do
p:= q; q:= nextprime(p);
d:= q^2-p^2;
if isprime(d+1) and isprime(d-1) then A:= A, p fi
od:
A; # Robert Israel, Mar 02 2018
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
Cf. A014574 (average of twin prime pairs), A069482 (difference between squares of consecutive primes).
Sequence in context: A088546 A265816 A246717 * A265792 A322669 A115591
KEYWORD
nonn
AUTHOR
Geoffrey Marnell, Nov 25 2017
STATUS
approved