login
Least nonnegative integer x such that n = x^2 + y^2 + z^2 + w^2 for some nonnegative integer y,z,w with x + 3*y + 5*z a square.
12

%I #6 May 19 2016 11:26:21

%S 0,0,1,1,0,1,1,1,0,0,0,1,0,0,1,2,0,0,0,1,1,2,2,1,0,0,0,1,1,0,0,5,4,0,

%T 0,1,0,1,0,1,0,0,1,1,0,0,1,2,4,0,0,1,1,4,0,1,0,0,0,0,5,0,0,2,0,0,1,0,

%U 1,1,2,3,0,0,0,1,0,0,0,3,4

%N Least nonnegative integer x such that n = x^2 + y^2 + z^2 + w^2 for some nonnegative integer y,z,w with x + 3*y + 5*z a square.

%C Clearly, a(n) = 0 if n is a square. Part (i) of the conjecture in A271518 implies that a(n) always exists.

%C Compare this sequence with A273294.

%C For more conjectural refinements of Lagrange's four-square theorem, one may consult arXiv:1604.06723.

%H Zhi-Wei Sun, <a href="/A273302/b273302.txt">Table of n, a(n) for n = 0..10000</a>

%H Zhi-Wei Sun, <a href="http://arxiv.org/abs/1604.06723">Refining Lagrange's four-square theorem</a>, arXiv:1604.06723 [math.GM], 2016.

%e a(6) = 1 since 6 = 1^2 + 1^2 + 0^2 + 2^2 with 1 + 3*1 + 5*0 = 2^2.

%e a(7) = 1 since 7 = 1^2 + 1^2 + 1^2 + 2^2 with 1 + 3*1 + 5*1 = 3^2.

%e a(15) = 2 since 15 = 2^2 + 3^2 + 1^2 + 1^2 with 2 + 3*3 + 5*1 = 4^2.

%e a(31) = 5 since 31 = 5^2 + 2^2 + 1^2 + 1^2 with 5 + 3*2 + 5*1 = 4^2.

%e a(32) = 4 since 32 = 4^2 + 0^2 + 0^2 + 4^2 with 4 + 3*0 + 5*0 = 2^2.

%e a(2384) = 24 since 2384 = 24^2 + 12^2 + 8^2 + 40^2 with 24 + 3*12 + 5*8 = 10^2.

%t SQ[n_]:=SQ[n]=IntegerQ[Sqrt[n]]

%t Do[Do[If[SQ[n-x^2-y^2-z^2]&&SQ[x+3y+5z],Print[n," ",x];Goto[aa]],{x,0,Sqrt[n]},{y,0,Sqrt[n-x^2]},{z,0,Sqrt[n-x^2-y^2]}];Label[aa];Continue,{n,0,80}]

%Y Cf. A000118, A000290, A260625, A261876, A262357, A267121, A268197, A268507, A269400, A270073, A271510, A271513, A271518, A271608, A271665, A271714, A271721, A271724, A271775, A271778, A271824, A272084, A272332, A272351, A272620, A272888, A272977, A273021, A273107, A273108, A273110, A273134, A273278, A273294.

%K nonn

%O 0,16

%A _Zhi-Wei Sun_, May 19 2016