OFFSET
0,5
COMMENTS
A(n,k) is the number of ways of writing n as a sum of k squares.
This is the transpose of the array in A122141.
LINKS
Seiichi Manyama, Antidiagonals n = 0..139, flattened
Wikipedia, Sum of squares function
FORMULA
G.f. of column k: (Product_{j>=1} (1 - x^(2*j))^5/((1 - x^j)*(1 - x^(4*j)))^2)^k.
EXAMPLE
Square array begins:
1, 1, 1, 1, 1, ...
0, 2, 4, 6, 8, ...
0, 0, 4, 12, 24, ...
0, 0, 0, 8, 32, ...
0, 2, 4, 6, 24, ...
MAPLE
A:= proc(n, k) option remember; `if`(n=0, 1, `if`(n<0 or k<1, 0,
A(n, k-1) +2*add(A(n-j^2, k-1), j=1..isqrt(n))))
end:
seq(seq(A(n, d-n), n=0..d), d=0..12); # Alois P. Heinz, May 27 2017
MATHEMATICA
A[n_, k_] := A[n, k] = If[n == 0, 1, If[n < 0 || k < 1, 0, A[n, k-1] + 2*Sum[A[n-j^2, k-1], {j, 1, Sqrt[n]}]]];
Table[A[n, d-n], {d, 0, 12}, {n, 0, d}] // Flatten (* Jean-François Alcover, Feb 28 2018, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn,tabl
AUTHOR
Seiichi Manyama, May 27 2017
STATUS
approved