OFFSET
1,4
COMMENTS
Since all odd squares are congruent to 1 mod 8, it is not possible to express any number congruent to 7 mod 8 as a sum of fewer than 7 odd squares.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..20000
EXAMPLE
a(2) = 1 because 15 = 9 + 1 + 1 + 1 + 1 + 1 + 1 is the only such representation.
a(4) = 2 because 31 = 25 + 1 + 1 + 1 + 1 + 1 + 1 = 9 + 9 + 9 + 1 + 1 + 1 + 1.
MAPLE
A130872recur := proc(n, jmin, N) local a, s ; if N =1 then if n mod 2 = 1 and issqr(n) and n>=jmin^2 then RETURN(1) ; else RETURN(0) ; fi ; else a := 0 ; for s from 2*floor(jmin/2)+1 to floor(sqrt(n)) by 2 do a := a+A130872recur(n-s^2, s, N-1) ; od ; RETURN(a) ; fi ; end: A130872 := proc(n) option remember: A130872recur(8*n-1, 1, 7) ; end: seq(A130872(n), n=1..100); # R. J. Mathar, Aug 02 2007
# second Maple program:
b:= proc(n, i) option remember; convert(series(`if`(n=0, 1, `if`(i<1, 0,
expand(add(b(n-i^2*j, i-2)*x^j, j=0..min(7, n/i^2))))), x, 8), polynom)
end:
a:= n-> coeff(b(8*n-1, (t-> `if`(t::odd, t, t-1))(isqrt(8*n-1))), x, 7):
seq(a(n), n=1..100); # Alois P. Heinz, Jan 27 2024
MATHEMATICA
a[n_] := IntegerPartitions[8 n - 1, {7}, Select[Range[1, 8 n - 1, 2], IntegerQ[Sqrt[#]]&]] // Length;
Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Jan 27 2024 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Joel B. Lewis, Jul 24 2007
EXTENSIONS
More terms from R. J. Mathar, Aug 02 2007
STATUS
approved