login
Primes p of the form 4k+1 such that the sum up to p of the primes of the same form is a square.
0

%I #33 Jul 19 2024 14:58:26

%S 29,61,197,11789,7379689,161409881,14881142931617,34041319775377

%N Primes p of the form 4k+1 such that the sum up to p of the primes of the same form is a square.

%e 5+13+17+29 = 64 = 8^2.

%e 5+...+161409881 = 354203842652416 = 18820304^2.

%t s=0; Select[Prime@ Range[10^9], Mod[#,4]==1 && IntegerQ@ Sqrt[s+=#] &] (* _Robert Price_, Sep 10 2020 *)

%t Module[{nn=74*10^5,k,a},k=Select[Prime[Range[nn]],Mod[#-1,4]==0&];a=Accumulate[ k];Select[ Thread[ {k,a}],IntegerQ[Sqrt[#[[2]]]]&]][[;;,1]] (* The program generates the first five terms of the sequence. *) (* _Harvey P. Dale_, Jul 19 2024 *)

%o (UBASIC)

%o 10 'S1=sum of primes 4k+1, S1=sum of primes 4k+1

%o 20 'is S1 a square?

%o 30 S1=0:P=2:PM=2^32-10:K=1

%o 40 P=nxtprm(P):K=K+1:if P>PM then end

%o 50 if P@4=3 then goto 40

%o 60 S1=S1+P:SS1=isqrt(S1)

%o 70 if SS1*SS1=S1 then print K;P;S1;SS1;1

%o 80 goto 40

%o (PARI) s=0;forprime(p=5,10^9,if(p%4==1,s+=p;if(issquare(s),print1(p,", ")))) \\ _Hugo Pfoertner_, Jun 02 2020

%Y Cf. A033998.

%K nonn,more

%O 1,1

%A _Carlos Rivera_, Jun 01 2020

%E a(7) and a(8) from _Martin Ehrenstein_ using Kim Walisch's primesieve, Jan 09 2021