cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A228424 Primes that can be written as a sum of a triangular number and a square.

Original entry on oeis.org

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

Views

Author

Zhi-Wei Sun, Nov 10 2013

Keywords

Comments

This sequence is interesting because of the conjecture in the comments in A228425.
Note that the sequence contains all primes of the form x^2 + 1 (A002496) since 1 is a triangular number.

Examples

			a(1) = 2 since 2 = 1*(1+1)/2 + 1^2.
a(2) = 3 since 3 = 2*(2+1)/2 + 0^2.
		

Crossrefs

Subsequence of A014133. Subsequences include A002496, A049423, A056909, A138355, and A243450.

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