OFFSET
1,1
COMMENTS
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]
FORMULA
Bhattacharya & Rahaman prove that a(n) ≍ n (log n)^(3/2). - Charles R Greathouse IV, Aug 28 2024
EXAMPLE
a(1) = 2 since 2 = 1*(1+1)/2 + 1^2.
a(2) = 3 since 3 = 2*(2+1)/2 + 0^2.
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}]
PROG
(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
CROSSREFS
KEYWORD
nonn,changed
AUTHOR
Zhi-Wei Sun, Nov 10 2013
STATUS
approved