OFFSET
0,1
COMMENTS
Every odd square is a number of the form 8*k + 1, so every sum of four odd squares is a number of the form 8*k + 4.
A316489 lists all positive numbers of the form 8*k + 4 that cannot be expressed as the sum of four distinct odd squares.
A316834 lists all numbers that can be expressed in only one way as the sum of four distinct odd squares.
If a(571) > 0 then a(571) > 4*10^6. For 48 values of 0 <= n <= 9999 a(n) = 0 or at least 4*10^6. - David A. Corneth, Nov 28 2020
LINKS
David A. Corneth, Table of n, a(n) for n = 0..570 (first 501 terms from Alois P. Heinz)
David A. Corneth, a(0)..a(9999) for values <= 4*10^6
EXAMPLE
The smallest positive number of the form 8*k + 4 is 4, which cannot be expressed as the sum of four distinct odd squares, so a(0) = 4.
The smallest number that can be expressed as the sum of four distinct odd squares is the sum of the first four odd squares, i.e., 1^2 + 3^2 + 5^2 + 7^2 = 84, which cannot be so expressed in any other way, so a(1) = 84.
a(6) = 420 because 420 is the smallest number that can be expressed as the sum of four distinct odd squares in exactly 6 ways:
420 = 1^2 + 3^2 + 7^2 + 19^2
= 1^2 + 3^2 + 11^2 + 17^2
= 1^2 + 5^2 + 13^2 + 15^2
= 1^2 + 7^2 + 9^2 + 17^2
= 5^2 + 7^2 + 11^2 + 15^2
= 7^2 + 9^2 + 11^2 + 13^2.
(Sums such as 3^2 + 5^2 + 5^2 + 19^2 are not counted because the four odd squares are not all distinct.)
MAPLE
b:= proc(n, i, t) option remember; `if`(n=0, `if`(t=0, 1, 0),
`if`(min(i, t)<1, 0, b(n, i-2, t)+
`if`(i^2>n, 0, b(n-i^2, i-2, t-1))))
end:
a:= proc(n) option remember; local k;
for k from 4 by 8 while n <> b(k, (r->
r+1-irem(r, 2))(isqrt(k)), 4) do od; k
end:
seq(a(n), n=0..50); # Alois P. Heinz, Aug 07 2018
MATHEMATICA
b[n_, i_, t_] := b[n, i, t] = If[n == 0, If[t == 0, 1, 0], If[Min[i, t] < 1, 0, b[n, i - 2, t] + If[i^2 > n, 0, b[n - i^2, i - 2, t - 1]]]];
a[n_] := a[n] = Module[{k}, For[k = 4, n != b[k, # + 1 - Mod[#, 2]& @ Floor @ Sqrt[k], 4], k += 8]; k];
a /@ Range[0, 50] (* Jean-François Alcover, Nov 27 2020, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Jon E. Schoenfield, Jul 28 2018
STATUS
approved