A228424 Primes that can be written as a sum of a triangular number and a square.
2, 3, 5, 7, 11, 17, 19, 29, 31, 37, 53, 59, 61, 67, 71, 79, 101, 103, 107, 109, 127, 131, 137, 149, 157, 179, 191, 197, 199, 211, 239, 241, 251, 257, 269, 271, 277, 311, 317, 331, 347, 349, 353, 359, 367, 379, 389, 397, 401, 409, 421, 431, 439, 449, 479, 487, 491, 499, 509, 521
Offset: 1
Keywords
Examples
a(1) = 2 since 2 = 1*(1+1)/2 + 1^2. a(2) = 3 since 3 = 2*(2+1)/2 + 0^2.
Links
- Zhi-Wei Sun, Table of n, a(n) for n = 1..10000
- Soumya Bhattacharya and Habibur Rahaman, Primes and polygonal numbers, arXiv:2408.13650 [math.NT]
Crossrefs
Programs
-
Mathematica
TQ[n_]:=IntegerQ[Sqrt[8n+1]] n=0 Do[Do[If[TQ[Prime[k]-x^2],n=n+1;Print[n," ",Prime[k]];Goto[aa]],{x,0,Sqrt[Prime[k]]}]; Label[aa];Continue,{k,1,100}]
-
PARI
istrg(n) = {if (! issquare(8*n+1), return (0)); return (1);} isok(p) = {for (i = 0, sqrtint(p), if (istrg(p-i^2), return (1)););} lista(nn) = {forprime(p=2, nn, if (isok(p), print1(p, ", ")););}
-
PARI
list(lim)=my(v=List(if(lim<3,[],[3]))); for(m=1,(sqrtint((lim\=1)*8+1)-1)\2, my(t=m*(m+1)/2); for(s=1,sqrtint(lim-t), my(p=t+s^2); if(isprime(p), listput(v,p)))); Set(v) \\ Charles R Greathouse IV, Aug 28 2024
Formula
Bhattacharya & Rahaman prove that a(n) ≍ n (log n)^(3/2). - Charles R Greathouse IV, Aug 28 2024
Comments