login
A219610
Number of ways n can be written as sum of squares < n.
5
1, 0, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 5, 6, 6, 6, 7, 9, 10, 10, 12, 13, 14, 14, 16, 18, 20, 21, 23, 26, 27, 28, 31, 34, 37, 38, 42, 46, 49, 50, 55, 60, 63, 66, 71, 78, 81, 84, 90, 97, 104, 107, 116, 124, 132, 135, 144, 154, 163, 169, 178, 192, 201, 209, 219, 235, 247, 256, 271, 286, 302, 311, 329, 347, 365, 378, 397, 420, 438, 455, 476, 503
OFFSET
0,6
COMMENTS
Inspired by A034295, but not involving the same geometrical idea & restrictions.
LINKS
FORMULA
a(n^2+1) >= A034295(n).
EXAMPLE
a(16)=7 since 16 = 3^2+7*1 = 3^2+2^2+3*1 = 2^2+12*1 = 2*2^2+8*1 = 3*2^2+4*1 = 4*2^2 = 16*1^2 (where 1 = 1^2).
a(17)=9 since 17 = 4^2+1 = 3^2+8*1 = 3^2+2^2+4*1 = 3^2+2*2^2 = 2^2+13*1 = 2*2^2+9*1 = 3*2^2+5*1 = 4*2^2+1 = 17*1^2.
MAPLE
b:= proc(n, i) option remember; `if`(n=0, 1,
`if`(i<1, 0, b(n, i-1) +`if`(i^2>n, 0, b(n-i^2, i))))
end:
a:= proc(n) local r; r:= isqrt(n);
b(n, r-`if`(r^2>=n, 1, 0))
end:
seq(a(n), n=0..100); # Alois P. Heinz, Apr 16 2013
MATHEMATICA
b[n_, i_] := b[n, i] = If[n == 0, 1,
If[i < 1, 0, b[n, i - 1] + If[i^2 > n, 0, b[n - i^2, i]]]];
a[n_] := With[{r = Floor@Sqrt[n]}, b[n, r - If[r^2 >= n, 1, 0]]];
Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Apr 28 2022, after Alois P. Heinz *)
PROG
(PARI) a(n, m)={!m && n<5 && return(n!=1); m || m=sqrtint(n-1); sum(k=2, m, sum(j=1, n\k^2, a(n-j*k^2, k-1)), 1)}
CROSSREFS
Cf. A034295.
Sequence in context: A263997 A135636 A025795 * A194161 A051066 A029159
KEYWORD
nonn
AUTHOR
M. F. Hasler, Apr 12 2013
STATUS
approved