# Greetings from The On-Line Encyclopedia of Integer Sequences! http://oeis.org/ Search: id:a295706 Showing 1-1 of 1 %I A295706 #35 Mar 02 2018 13:16:27 %S A295706 7,17,23,37,47,59,83,89,107,113,127,131,149,163,173,257,353,433,439, %T A295706 457,467,521,563,761,773,839,881,953,1009,1031,1213,1307,1319,1321, %U A295706 1697,1733,1759,1811,1861,1871,1913,1979,2153,2221,2281,2287,2309,2393,2593,2767,2789 %N 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. %C A295706 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. %H A295706 Robert Israel, Table of n, a(n) for n = 1..10000 %e A295706 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. %e A295706 Likewise, the difference between the square of 563 and the next prime (569) is 6792, and 6791 and 6793 are twin primes. %p A295706 N:= 10^4: # to get all terms <= N %p A295706 p:= 1: q:= 2: A:= NULL: %p A295706 while p < N do %p A295706 p:= q; q:= nextprime(p); %p A295706 d:= q^2-p^2; %p A295706 if isprime(d+1) and isprime(d-1) then A:= A, p fi %p A295706 od: %p A295706 A; # _Robert Israel_, Mar 02 2018 %t A295706 For[p = 1, p < 10000, p++, %t A295706 a = Prime[p]; %t A295706 b = Prime[p + 1]; %t A295706 c = b^2 - a^2; %t A295706 d = (c + 1); %t A295706 e = (c - 1); %t A295706 If[And[PrimeQ[d] == True, PrimeQ[e] == True], Print[a]]; %t A295706 ] %t A295706 (* Second program: *) %t A295706 Select[Partition[Prime@ Range@ 300, 2, 1], AllTrue[{# + 1, # - 1}, PrimeQ] &[#2^2 - #1^2] & @@ # &][[All, 1]] (* _Michael De Vlieger_, Dec 03 2017 *) %o A295706 (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 %Y A295706 Cf. A014574 (average of twin prime pairs), A069482 (difference between squares of consecutive primes). %K A295706 nonn %O A295706 1,1 %A A295706 _Geoffrey Marnell_, Nov 25 2017 # Content is available under The OEIS End-User License Agreement: http://oeis.org/LICENSE