%I
%S 1,1,3,5,1,2,4,1,2,4,1,6,4,1,3,5,1,4,3,3,4,4,2,2,3,2,3,8,1,3,4,1,5,5,
%T 2,4,3,2,2,4,1,7,7,2,4,3,2,6,3,3,3,9,2,5,4,1,5,4,2,6,4,3,6,5,2,5,2,2,
%U 4,6,2,4,6,4,5,6,3,4,4,3
%N Number of ordered ways to write n as x^2 + y^2 + z^2 + w^2 with x + y + z + w = 2^(floor((ord_2(n)+1)/2)), where ord_2(n) is the 2adic order of n, and x,y,z,w are integers with x <= y <= z <= w.
%C The author proved in arXiv:1701.05868 that a(n) > 0 for all n > 0. This is stronger than Lagrange's foursquare theorem.
%C It seems that a(n) = 1 only for n = 1, 5, 11, 17, 29, 41, 101, 107, 2*4^k and 14*4^k (k = 0,1,2,...).
%H ZhiWei Sun, <a href="/A281494/b281494.txt">Table of n, a(n) for n = 1..10000</a>
%H ZhiWei Sun, <a href="http://dx.doi.org/10.1016/j.jnt.2016.11.008">Refining Lagrange's foursquare theorem</a>, J. Number Theory 175(2017), 167190.
%H ZhiWei Sun, <a href="http://arxiv.org/abs/1701.05868">Restricted sums of four squares</a>, arXiv:1701.05868 [math.NT], 2017.
%e a(1) = 1 since 1 = 0^2 + 0^2 + 0^2 + 1^2 with 0 + 0 + 0 + 1 = 1 =2^0 = 2^(floor((ord_2(1)+1)/2)).
%e a(2) = 1 since 2 = 0^2 + 0^2 + 1^2 + 1^2 with 0 + 0 + 1 + 1 = 2 = 2^(floor((ord_2(2)+1)/2)).
%e a(5) = 1 since 5 = 0^2 + 0^2 + (1)^2 + 2^2 with 0 + 0 + (1) + 2 = 1 = 2^0 = 2^(floor((ord_2(5)+1)/2)).
%e a(6) = 2 since 6 = 0^2 + 1^2 + (1)^2 + 2^2 = 0^2 + (1)^2 + 1^2 + 2^2 with 0 + 1 + (1) + 2 = 0 + (1) + 1 + 2 = 2 = 2^(floor((ord_2(6)+1)/2)).
%e a(11) = 1 since 11 = 0^2 + (1)^2 + (1)^2 + 3^2 with 0 + (1) + (1) + 3 = 1 = 2^0 = 2^(floor((ord_2(11)+1)/2)).
%e a(14) = 1 since 14 = 0^2 + 1^2 + (2)^2 + 3^2 with 0 + 1 + (2) + 3 = 2 = 2^(floor((ord_2(14)+1)/2)).
%e a(17) = 1 since 17 = 0^2 + 2^2 + 2^2 + (3)^2 with 0 + 2 + 2 + (3) = 1 = 2^0 = 2^(floor((ord_2(17)+1)/2)).
%e a(41) = 1 since 41 = 0^2 + 0^2 + (4)^2 + 5^2 with 0 + 0 + (4) + 5 = 1 = 2^0 = 2^(floor((ord_2(41)+1)/2)).
%e a(101) = 1 since 101 = 0^2 + (1)^2 + (6)^2 + 8^2 with 0 + (1) + (6) + 8 = 1 = 2^0 = 2^(floor((ord_2(101)+1)/2)).
%e a(107) = 1 since 107 = (1)^2 + (3)^2 + (4)^2 + 9^2 with (1) + (3) + (4) + 9 = 1 = 2^0 = 2^(floor((ord_2(107)+1)/2)).
%t SQ[n_]:=SQ[n]=IntegerQ[Sqrt[n]];
%t Ord[p_,n_]=Ord[p,n]=IntegerExponent[n,p];
%t Do[r=0;Do[If[SQ[nx^2y^2z^2]&&((1)^i*x+(1)^j*y+(1)^k*z+(1)^s*Sqrt[nx^2y^2z^2]==2^(Floor[(Ord[2,n]+1)/2])),r=r+1],{x,0,Sqrt[n/4]},{i,0,Min[x,1]},{y,x,Sqrt[(nx^2)/3]},{j,0,Min[y,1]},{z,y,Sqrt[(nx^2y^2)/2]},{k,0,Min[z,1]},{s,0,Min[Sqrt[nx^2y^2z^2],1]}];
%t Print[n," ",r];Continue,{n,1,80}]
%Y Cf. A000079, A000118, A000290, A272620, A273458.
%K nonn
%O 1,3
%A _ZhiWei Sun_, Jan 22 2017
