login
Integers n such that n^2 - 1 is the difference of the squares of twin primes.
0

%I #26 Mar 30 2015 10:51:25

%S 5,7,11,13,17,31,41,43,49,77,83,101,109,119,133,179,203,263,277,283,

%T 307,311,329,353,377,407,413,419,431,437,463,473,493,577,581,619,629,

%U 703,757,791,811,907,911,913,991,1001,1037,1061,1103,1121,1249,1289,1337,1373,1441,1457,1487,1523,1597,1651,1781

%N Integers n such that n^2 - 1 is the difference of the squares of twin primes.

%e 31^2 - 1 = 241^2 - 239^2, and (239, 241) is a twin prime pair, so 31 is in the sequence.

%t lst={};f[n_]:=Sqrt[Prime[n]^2-NextPrime[Prime[n],-1]^2+1];

%t Do[If[Prime[n]-NextPrime[Prime[n],-1]==2&&IntegerQ[f[n]],AppendTo[lst,f[n]]],{n,3,10^5}];lst (* _Ivan N. Ianakiev_, Mar 30 2015 *)

%o (PARI) lista(nn) = {forprime(p=3, nn, q = precprime(p-1); if (((p-q) == 2) && issquare(d=p^2-q^2+1), print1(sqrtint(d), ", ")); ); } \\ _Michel Marcus_, Feb 18 2015

%Y Cf. A088486 (corresponding lesser twin primes), A111046.

%K nonn

%O 1,1

%A _Neri Gionata_, Feb 18 2015