%I #28 Oct 06 2023 12:53:32
%S 9,2474,6694,7785,709838,126789311423
%N Numbers n such that sum of first n primes is a square.
%C Szabolcs Tengely asks if this sequence is infinite (see Lorentz Center paper). Luca shows that this sequence is of asymptotic density 0. Cilleruelo & Luca give a lower bound. - _Charles R Greathouse IV_, Feb 01 2013
%D Florian Luca, On the sum of the first n primes being a square, Lithuanian Mathematical Journal 47:3 (2007), pp 243-247.
%H Jan-Hendrik Evertse, <a href="http://www.math.leidenuniv.nl/~evertse/07-workshop-problems.pdf">Some open problems about Diophantine equations</a>, Solvability of Diophantine Equations conference, Lorentz Center of Leiden University, The Netherlands.
%H Javier Cilleruelo and Florian Luca, <a href="http://digital.csic.es/bitstream/10261/31070/1/Sum%2520of%2520primes.pdf">On the sum of the first n primes</a>, Q. J. Math. 59:4 (2008), 14 pp.
%H G. L. Honaker Jr. and C. Caldwell, <a href="https://t5k.org/curios/page.php?curio_id=179">Prime Curios!: 9</a>
%H Carlos Rivera, <a href="http://www.primepuzzles.net/puzzles/puzz_009.htm">Puzzle 9. Sum of first k primes is perfect square</a>, The Prime Puzzles and Problems Connection.
%F a(n) = pi(A033998(n)).
%e Sum of first 9 primes is 2+3+5+7+11+13+17+19+23 = 100, which is square, so 9 is in the sequence.
%t p = 2; s = 0; lst = {}; While[p < 10^7, s = s + p; If[ IntegerQ@ Sqrt@ s, AppendTo[lst, PrimePi@ p]; Print@ lst]; p = NextPrime@ p] (* Zak Seidov, Apr 11 2011 *)
%o (PARI) n=0;s=0;forprime(p=2,1e6,n++;if(issquare(s+=p),print1(n", "))) \\ _Charles R Greathouse IV_, Feb 01 2013
%Y Cf. A000040, A033998, A061888, A061890 (associated squares).
%Y Cf. also A175133, A364696, A366270.
%K nonn
%O 1,1
%A Calculated by _Jud McCranie_
%E 126789311423 from _Giovanni Resta_, May 27 2003
%E Edited by _Ray Chandler_, Mar 20 2007