login
Primes p such that p^2 - q + 1 is prime, where p, q are consecutive primes and p<q.
1

%I #10 Sep 08 2022 08:46:12

%S 2,3,5,11,17,29,71,101,149,197,269,419,523,599,617,641,683,761,857,

%T 997,1061,1063,1091,1151,1201,1277,1289,1409,1531,1571,1607,1753,1789,

%U 1987,2027,2039,2111,2129,2161,2267,2309,2339,2503,2687,2753,2999,3049,3067,3257

%N Primes p such that p^2 - q + 1 is prime, where p, q are consecutive primes and p<q.

%H K. D. Bajpai, <a href="/A258185/b258185.txt">Table of n, a(n) for n = 1..10000</a>

%e a(4) = 11 is prime: 13 is next prime. 11^2 - 13 + 1 = 109 which is also prime.

%e a(5) = 17 is prime: 19 is next prime. 17^2 - 19 + 1 = 271 which is also prime.

%t Select[Prime[Range[1000]], PrimeQ[#^2 - NextPrime[#] + 1] &]

%t Select[Partition[Prime[Range[500]],2,1],PrimeQ[#[[1]]^2-#[[2]]+1]&][[All,1]] (* _Harvey P. Dale_, Sep 06 2016 *)

%o (PARI) c=0; forprime(p = 1,1e6, if(isprime(p^2 - nextprime(p+1) + 1), c++; print(c," ",p)))

%o (Magma) [n: n in [0..10^4] | IsPrime(n) and IsPrime(n^2 - NextPrime(n) +1)]; // _Vincenzo Librandi_, May 23 2015

%Y Cf. A000040, A055494, A236477, A236478.

%K nonn,easy

%O 1,1

%A _K. D. Bajpai_, May 23 2015

%E Definition clarified by _Harvey P. Dale_, Sep 06 2016