A300510 Number of ways to write n^2 as 4^k*(m^2+1) + x^2 + y^2, where m is 1 or 2, and k,x,y are nonnegative integers with x <= y.
0, 1, 2, 1, 3, 3, 3, 1, 4, 4, 5, 3, 5, 4, 6, 1, 3, 4, 5, 4, 7, 6, 5, 3, 8, 6, 6, 4, 5, 7, 7, 1, 5, 4, 11, 4, 7, 5, 6, 4, 6, 8, 5, 6, 12, 5, 5, 3, 6, 9, 8, 6, 7, 6, 10, 4, 7, 7, 6, 7, 5, 9, 9, 1, 8, 5, 10, 4, 9, 11, 9, 4, 11, 7, 12, 5, 8, 7, 7, 4
Offset: 1
Keywords
Examples
a(1) = 0 since 1^2 - 4^k*(m^2+1) < 0 for k = 0,1,2,... and m = 1, 2. a(2) = 1 since 2^2 = 4^0*(1^2+1) + 1^2 + 1^2. a(3) = 2 since 3^2 = 4^0*(2^2+1) + 0^2 + 2^2 = 4^1*(1^2+1) + 0^2 + 1^2.
Links
- Zhi-Wei Sun, Table of n, a(n) for n = 1..10000
- Zhi-Wei Sun, Refining Lagrange's four-square theorem, J. Number Theory 175(2017), 167-190.
- Zhi-Wei Sun, Restricted sums of four squares, arXiv:1701.05868 [math.NT], 2017-2018.
Crossrefs
Programs
-
Mathematica
f[n_]:=f[n]=FactorInteger[n]; g[n_]:=g[n]=Sum[Boole[Mod[Part[Part[f[n],i],1]-3,4]==0&&Mod[Part[Part[f[n],i],2],2]==1],{i,1,Length[f[n]]}]==0; QQ[n_]:=QQ[n]=n==0||(n>0&&g[n]); SQ[n_]:=SQ[n]=IntegerQ[Sqrt[n]]; tab={};Do[r=0;Do[If[QQ[n^2-4^k*(m^2+1)],Do[If[SQ[n^2-4^k(m^2+1)-x^2],r=r+1],{x,0,Sqrt[(n^2-4^k(m^2+1))/2]}]],{m,1,2},{k,0,Log[4,n^2/(m^2+1)]}];tab=Append[tab,r],{n,1,80}];Print[tab]
Comments