Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #13 Aug 18 2017 09:55:57
%S 1,2,2,1,3,3,1,3,3,2,5,3,2,4,2,3,4,4,2,3,4,2,4,1,2,8,4,2,3,5,3,5,5,2,
%T 4,4,4,6,5,3,8,4,3,6,1,5,7,6,2,5,6,3,8,3,3,5,5,5,4,4,5,6,3,2,7,8,4,8,
%U 5,2,8,5,3,8,7,4,6,4,3,4,8
%N Number of ways to write 4*n+1 as (p-1)^2 + q^2 + r^2, where p is prime and q and r are nonnegative integers with q <= r.
%C Conjecture: (i) a(n) > 0 for all n, and a(n) = 1 only for n = 0, 3, 6, 23, 44.
%C (ii) Any positive integer relatively prime to 6 can be written as (p-1)^2 + q^2 + 3*r^2, where p is prime, and q and r are integers.
%C (iii) Let n be any nonnegative integer. Then 4*n+1 can be written as x^2 + y^2 + z^2, where x,y,z are nonnegative integers with x + y + 2*z prime; 4*n+2 can be written as x^2 + y^2 + z^2, where x,y,z are nonnegative integers with x + 3*y prime. Also, we can write 4*n+3 as 2*x^2 + y^2 + z^2, where x,y,z are nonnegative integers with 2*x+1 prime.
%C (iv) Let n be any nonnegative integer. Then we can write 4*n+1 as x^2 + y^2 + z^2 with x,y,z integers such that x^2 + 5*y^2 + 7*z^2 prime, and write 4*n+2 as x^2 + y^2 + z^2 with x,y,z integers such that x^2 + 2*y^2 + 5*z^2 prime. Also, we can write 8*n+3 as x^2 + y^2 + z^2 with x,y,z integers such that 2*x^2 + 4*y^2 + 5*z^2 is prime.
%C Note that by the Gauss-Legendre theorem any positive integer not of the form 4^k*(8*m+7) (k,m = 0,1,2,...) can be written as the sum of three squares.
%H Zhi-Wei Sun, <a href="/A291123/b291123.txt">Table of n, a(n) for n = 0..10000</a>
%H Zhi-Wei Sun, <a href="http://dx.doi.org/10.1016/j.jnt.2016.11.008">Refining Lagrange's four-square theorem</a>, J. Number Theory 175(2017), 167-190.
%H Zhi-Wei Sun, <a href="http://arxiv.org/abs/1701.05868">Restricted sums of four squares</a>, arXiv:1701.05868 [math.NT], 2017.
%e a(0) = 1 since 4*0+1 = (2-1)^2 + 0^2 + 0^2 with 2 prime.
%e a(3) = 1 since 4*3+1 = (3-1)^2 + 0^2 + 3^2 with 3 prime.
%e a(6) = 1 since 4*6+1 = (5-1)^2 + 0^2 + 3^2 with 5 prime.
%e a(23) = 1 since 4*23+1 = (3-1)^2 + 5^2 + 8^2 with 3 prime.
%e a(44) = 1 since 4*44+1 = (3-1)^2 + 2^2 + 13^2 with 3 prime.
%t SQ[n_]:=SQ[n]=IntegerQ[Sqrt[n]];
%t Do[r=0;Do[If[PrimeQ[p]&&SQ[4n+1-(p-1)^2-q^2],r=r+1],{p,2,Sqrt[4n+1]+1},{q,0,Sqrt[(4n+1-(p-1)^2)/2]}];Print[n," ",r],{n,0,80}]
%Y Cf. A000040, A000290, A260418, A271518, A290472, A290491, A291047.
%K nonn
%O 0,2
%A _Zhi-Wei Sun_, Aug 17 2017