A299794 Number of ways to write n^2 as x^2 + y^2 + z^2 + w^2 with x >= y >= 0 <= z <= w such that x or 2*y is a power of 4 (including 4^0 = 1) and x + 15*y is also a power of 4.
1, 1, 1, 1, 1, 3, 1, 1, 4, 2, 1, 1, 2, 3, 1, 1, 2, 2, 1, 1, 6, 3, 1, 3, 3, 2, 2, 1, 3, 4, 2, 1, 5, 4, 4, 5, 1, 2, 3, 2, 5, 5, 2, 2, 8, 2, 2, 1, 5, 2, 4, 3, 4, 4, 4, 3, 6, 3, 2, 3, 3, 4, 3, 1, 3, 6, 4, 3, 11, 2, 2, 2, 4, 5, 1, 2, 3, 5, 3, 1
Offset: 1
Keywords
Examples
a(2) = 1 since 2^2 = 1^2 + 1^2 + 1^2 + 1^2 with 1 = 4^0 and 1 + 15*1 = 4^2. a(5) = 1 since 5^2 = 4^2 + 0^2 + 0^2 + 3^2 with 4 = 4^1 and 4 + 15*0 = 4^1. a(19) = 1 since 19^2 = 1^2 + 0^2 + 6^2 + 18^2 with 1 = 4^0 and 1 + 15*0 = 4^0. a(159) = 1 since 159^2 = 34^2 + 2^2 + 75^2 + 136^2 with 2*2 = 4^1 and 34 + 15*2 = 4^3. a(1998) = 1 since 1998^2 = 256^2 + 256^2 + 286^2 + 1944^2 with 256 = 4^4 and 256 + 15*256 = 4^6. a(3742) = 1 since 3742^2 = 2176^2 + 128^2 + 98^2 + 3040^2 with 2*128 = 4^4 and 2176 + 15*128 = 4^6.
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
SQ[n_]:=SQ[n]=IntegerQ[Sqrt[n]]; Pow[n_]:=Pow[n]=IntegerQ[Log[4,n]]; tab={};Do[r=0;Do[If[Pow[2y]||Pow[4^k-15y],Do[If[SQ[n^2-y^2-(4^k-15y)^2-z^2],r=r+1],{z,0,Sqrt[Max[0,(n^2-y^2-(4^k-15y)^2)/2]]}]], {k,0,Log[4,Sqrt[226]*n]},{y,0,Min[n,4^(k-2)]}];tab=Append[tab,r],{n,1,80}];Print[tab]
Comments