login

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

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

%I #42 Nov 06 2024 08:47:42

%S 2,3,5,7,11,17,19,29,31,37,53,59,61,67,71,79,101,103,107,109,127,131,

%T 137,149,157,179,191,197,199,211,239,241,251,257,269,271,277,311,317,

%U 331,347,349,353,359,367,379,389,397,401,409,421,431,439,449,479,487,491,499,509,521

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

%C This sequence is interesting because of the conjecture in the comments in A228425.

%C Note that the sequence contains all primes of the form x^2 + 1 (A002496) since 1 is a triangular number.

%H Zhi-Wei Sun, <a href="/A228424/b228424.txt">Table of n, a(n) for n = 1..10000</a>

%H Soumya Bhattacharya and Habibur Rahaman, <a href="https://arxiv.org/abs/2408.13650">Primes and polygonal numbers</a>, arXiv:2408.13650 [math.NT]

%F Bhattacharya & Rahaman prove that a(n) ≍ n (log n)^(3/2). - _Charles R Greathouse IV_, Aug 28 2024

%e a(1) = 2 since 2 = 1*(1+1)/2 + 1^2.

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

%t TQ[n_]:=IntegerQ[Sqrt[8n+1]]

%t n=0

%t Do[Do[If[TQ[Prime[k]-x^2],n=n+1;Print[n," ",Prime[k]];Goto[aa]],{x,0,Sqrt[Prime[k]]}];

%t Label[aa];Continue,{k,1,100}]

%o (PARI) istrg(n) = {if (! issquare(8*n+1), return (0)); return (1);}

%o isok(p) = {for (i = 0, sqrtint(p), if (istrg(p-i^2), return (1)););}

%o lista(nn) = {forprime(p=2, nn, if (isok(p), print1(p, ", ")););}

%o (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

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

%Y Cf. A000040, A000217, A000290, A228425.

%K nonn

%O 1,1

%A _Zhi-Wei Sun_, Nov 10 2013