A300708 Number of ways to write n as x^2 + y^2 + z^2 + w^2 with x,y,z,w nonnegative integers and z <= w such that x or y is a square and x - y is also a square.
1, 2, 3, 2, 2, 3, 3, 2, 1, 3, 4, 2, 1, 2, 2, 2, 2, 3, 5, 2, 3, 3, 2, 1, 1, 5, 6, 5, 2, 3, 5, 3, 3, 4, 7, 3, 5, 4, 3, 3, 2, 8, 8, 4, 1, 6, 4, 1, 2, 3, 9, 7, 6, 3, 5, 4, 1, 6, 5, 3, 2, 5, 3, 3, 2, 5, 11, 4, 3, 4, 5, 1, 2, 5, 5, 6, 3, 5, 4, 2, 3
Offset: 0
Keywords
Examples
a(71) = 1 since 71 = 5^2 + 1^2 + 3^2 + 6^2 with 1 = 1^2 and 5 - 1 = 2^2. a(95) = 1 since 95 = 2^2 + 1^2 + 3^2 + 9^2 with 1 = 1^2 and 2 - 1 = 1^2. a(344) = 1 since 344 = 4^2 + 0^2 + 2^2 + 18^2 with 4 = 2^2 and 4 - 0 = 2^2. a(428) = 1 since 428 = 13^2 + 9^2 + 3^2 + 13^2 with 9 = 3^2 and 13 - 9 = 2^2. a(632) = 1 since 632 = 16^2 + 12^2 + 6^2 + 14^2 with 16 = 4^2 and 16 - 12 = 2^2. a(1144) = 1 since 1144 = 20^2 + 16^2 + 2^2 + 22^2 with 16 = 4^2 and 20 - 16 = 2^2. a(1544) = 1 since 1544 = 0^2 + 0^2 + 10^2 + 38^2 with 0 = 0^2 and 0 - 0 = 0^2.
Links
- Zhi-Wei Sun, Table of n, a(n) for n = 0..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.
Programs
-
Mathematica
SQ[n_]:=SQ[n]=IntegerQ[Sqrt[n]]; tab={};Do[r=0;Do[If[(SQ[m^2+y]||SQ[y])&&SQ[n-(m^2+y)^2-y^2-z^2],r=r+1],{m,0,n^(1/4)},{y,0,Sqrt[(n-m^4)/2]},{z,0,Sqrt[Max[0,(n-(m^2+y)^2-y^2)/2]]}];tab=Append[tab,r],{n,0,80}];Print[tab]
Comments