A097203 Number of 4-tuples (a,b,c,d) with 1 <= a <= b <= c <= d, a^2+b^2+c^2+d^2 = n and gcd(a,b,c,d) = 1.
0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 2, 0, 1, 2, 0, 1, 2, 1, 1, 2, 1, 2, 0, 0, 3, 2, 1, 2, 1, 2, 0, 2, 2, 1, 3, 1, 2, 3, 0, 2, 4, 1, 2, 2, 1, 3, 0, 1, 3, 3, 2, 2, 4, 2, 0, 3, 2, 3, 3, 2, 3, 3, 0, 2, 5, 2, 3, 3, 2, 4, 0, 1, 5, 4, 2, 4, 2, 3, 0, 4, 4, 3
Offset: 1
Keywords
Examples
The solutions (if any) for n <= 20 are as follows: n = 1: n = 2: n = 3: n = 4: 1 1 1 1 n = 5: n = 6: n = 7: 1 1 1 2 n = 8: n = 9: n = 10: 1 1 2 2 n = 11: n = 12: 1 1 1 3 n = 13: 1 2 2 2 n = 14: n = 15: 1 1 2 3 n = 16: n = 17: n = 18: 1 2 2 3 n = 19: 1 1 1 4 n = 20: 1 1 3 3 From _Wolfdieter Lang_, Mar 25 2013: (Start) a(16) = 0 because 16 is not a primitive sum of four nonzero squares. The representation [2,2,2,2] of 16 is not primitive. a(40) = 0 because the only representation as sum of four nonzero squares (A025428(4) = 1) is [2,2,4,4], but this is not primitive. a(28) = 2 because the two primitive representations of 28 are [1, 1, 1, 5] and [1, 3, 3, 3]. [2, 2, 2, 4] = 2*[1, 1, 1, 2] is not primitive due to 28 = 2^2*7. (End)
Links
- N. J. A. Sloane, Vinay Vaishampayan and Alois P. Heinz, Table of n, a(n) for n = 1..10000 (terms n = 1..1024 from N. J. A. Sloane and Vinay Vaishampayan)
Programs
-
Maple
b:= proc(n, i, g, t) option remember; `if`(n=0, `if`(g=1 and t=0, 1, 0), `if`(i<1 or t=0 or i^2*t
n, 0, b(n-i^2, i, igcd(g, i), t-1)))) end: a:= n-> `if`(n<4, 0, b(n, isqrt(n-3), 0, 4)): seq(a(n), n=1..120); # Alois P. Heinz, Apr 02 2013 -
Mathematica
Clear[b]; b[n_, i_, g_, t_] := b[n, i, g, t] = If[n == 0, If[g == 1 && t == 0, 1, 0], If[i < 1 || t == 0 || i^2*t < n, 0, b[n, i-1, g, t] + If[i^2 > n, 0, b[n-i^2, i, GCD[g, i], t-1]]]]; a[n_] := If[n < 4, 0, b[n, Sqrt[n-3] // Floor, 0, 4]]; Table[a[n], {n, 1, 99}] (* Jean-François Alcover, Apr 05 2013, translated from Alois P. Heinz's Maple program *)
Formula
If a(n) > 0 then 8 does not divide n.
a(n) = k if there are k different quadruples [s(1),s(2),s(3),s(4)] with 1 <= s(1) <= s(2) <= s(3) <= s(4), gcd(s(1),s(2),s(3),s(4)) = 1 and sum(s(j)^2,j=1..4) = n. If there is no such quadruple then a(n) = 0. - Wolfdieter Lang, Mar 25 2013
Comments