login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Primes p such that p = q^2 + 2*r^2 where q and r are also primes.
6

%I #28 Oct 24 2024 11:02:23

%S 17,43,59,67,107,139,251,307,347,379,547,587,859,1699,1867,1931,3371,

%T 3499,3739,4507,5059,5347,6907,6971,7451,10091,10627,10667,11467,

%U 12491,18787,20411,21227,22907,29947,32059,32779,37547,38651,39619,49307,49747,53147

%N Primes p such that p = q^2 + 2*r^2 where q and r are also primes.

%H Colin Barker and Chai Wah Wu, <a href="/A260553/b260553.txt">Table of n, a(n) for n = 1..1873</a> n = 1..150 from Colin Barker.

%e 43 is in the sequence because 43 = 5^2 + 2*3^2 and 43, 5 and 3 are all primes.

%t Select[#1^2 + 2 #2^2 & @@ # & /@ Tuples[Prime@ Range@ 60, 2], PrimeQ] // Sort (* _Michael De Vlieger_, Jul 29 2015 *)

%o (PARI) lista(nn)=forprime(p=2, nn, forprime(r=2, sqrtint(p\2), if (issquare(q2 = p-2*r^2) && isprime(sqrtint(q2)), print1(p, ", ")););); \\ _Michel Marcus_, Jul 29 2015

%o (PARI) list(lim)=my(v=List()); lim\=1; forprime(q=2, sqrtint((lim-9)\2), my(t=2*q^2); forprime(p=3, sqrtint(lim-t), my(r=t+p^2); if(isprime(r), listput(v, r)))); Set(v) \\ _Charles R Greathouse IV_, Oct 09 2024

%o (Python)

%o from sympy import prime, isprime

%o n = 5000

%o A260553_list, plimit = [], prime(n)**2+8

%o for i in range(1, n):

%o q = 2*prime(i)**2

%o for j in range(1, n):

%o p = q + prime(j)**2

%o if p < plimit and isprime(p):

%o A260553_list.append(p)

%o A260553_list = sorted(A260553_list) # _Chai Wah Wu_, Jul 30 2015

%Y Main entry for this sequence is A201613.

%Y Cf. A260554, A260555, A260556, A260557.

%K nonn

%O 1,1

%A _Colin Barker_, Jul 29 2015