%I #21 Apr 30 2019 12:18:47
%S 3,5,11,17,19,29,43,53,79,101,113,127,137,179,251,281,349,409,419,431,
%T 449,521,569,571,577,599,643,661,677,739,797,823,853,857,883,907,941,
%U 991,1009,1049,1087,1091,1129,1163,1181,1259,1289,1381,1451,1459,1489
%N Primes p such that p^2 - 1 is the sum of two consecutive primes.
%H Zak Seidov, <a href="/A092740/b092740.txt">Table of n, a(n) for n = 1..1200</a>
%e Sequence contains the prime 3 because 3+5+1 = 3^2, the prime 5 because 11+13+1 = 5^2, the prime 11 because 59+61+1 = 11^2, the prime 17 because 139+149+1 = 17^2, etc.
%p seq( ifactor(ithprime(x)+ithprime(x+1)+1),x=1..20); # check squares of primes
%t f[n_] := Block[{k = Prime[n] + Prime[n + 1] + 1}, If[IntegerQ[ Sqrt[k]], k, 0]]; Select[ Sqrt[ f[ # ]] & /@ Select[ Range[10000], f[ # ] != 0 &], PrimeQ[ # ] &] (* _Robert G. Wilson v_, Apr 15 2004 *)
%t tspQ[n_]:=Module[{c=n^2-1},NextPrime[c/2]+NextPrime[c/2,-1]==c]; Select[ Prime[ Range[250]],tspQ] (* _Harvey P. Dale_, Apr 30 2019 *)
%o (PARI) is(n) = precprime((n-1)/2)+nextprime(n/2) == n; \\ A001043
%o isok(p) = isprime(p) && is(p^2-1); \\ _Michel Marcus_, Mar 16 2019
%Y Cf. A001043, A045408.
%K nonn
%O 1,1
%A _Jorge Coveiro_, Apr 12 2004
%E Edited by _Robert G. Wilson v_ and _Don Reble_, Apr 15 2004
|