%I #7 May 19 2016 08:53:02
%S 0,0,1,2,0,1,2,3,4,0,1,2,3,3,3,4,0,1,2,3,2,3,3,4,4,0,1,2,3,3,4,4,2,3,
%T 3,4,0,1,2,3,4,2,3,6,4,3,3,6,4,0,1,2,2,3,5,4,4,4,3,4,5,5,3,4,0,1,2,3,
%U 4,5,4,6,4,3,4,4,4,3,4,4,2
%N Least nonnegative integer m such that there are nonnegative integers x,y,z,w for which x^2 + y^2 + z^2 + w^2 = n and x + 3*y + 5*z = m^2.
%C Clearly, a(n) = 0 if n is a square. Part (i) of the conjecture in A271518 implies that a(n) always exists.
%C For more conjectural refinements of Lagrange's four-square theorem, one may consult arXiv:1604.06723.
%H Zhi-Wei Sun, <a href="/A273294/b273294.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(1) = 0 since 1 = 0^2 + 0^2 + 0^2 + 1^2 with 0 + 3*0 + 5*0 = 0^2.
%e a(2) = 1 since 2 = 1^2 + 0^2 + 0^2 + 1^2 with 1 + 3*0 + 5*0 = 1^2.
%e a(3) = 2 since 3 = 1^2 + 1^2 + 0^2 + 1^2 with 1 + 3*1 + 5*0 = 2^2.
%e a(3812) = 11 since 3812 = 37^2 + 3^2 + 15^2 + 47^2 with 37 + 3*3 + 5*15 = 11^2.
%e a(3840) = 16 since 3840 = 48^2 + 16^2 + 32^2 + 16^2 with 48 + 3*16 + 5*32 = 16^2.
%t SQ[n_]:=SQ[n]=IntegerQ[Sqrt[n]]
%t Do[m=0;Label[bb];Do[If[3y+5z<=m^2&&SQ[n-y^2-z^2-(m^2-3y-5z)^2],Print[n," ",m];Goto[aa]],{y,0,Sqrt[n]},{z,0,Sqrt[n-y^2]}];m=m+1;Goto[bb];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.
%K nonn
%O 0,4
%A _Zhi-Wei Sun_, May 19 2016