close
login
A392127
The smallest k >= 0 that can be represented as a linear combination of 1^2, 2^2, ..., n^2 with coefficients +-1 and that cannot be represented using 1^2, 2^2, ..., m^2 with 1<=m<n.
3
1, 3, 4, 2, 13, 7, 0, 44, 25, 61, 52, 250, 241, 563, 458, 984, 823, 1529, 1272, 2214, 1853, 3055, 2614, 4068, 3539, 5269, 4644, 6674, 5945, 8299, 7458, 10160, 9199, 12273, 11184, 14654, 13429, 17319, 15950, 20284, 18763, 23565, 21884, 27178, 25329, 31139, 29114
OFFSET
1,2
COMMENTS
a(n) is the smallest k >= 0 such that A231015(k) = n.
LINKS
EXAMPLE
a(1) = 1: 1^2 = 1.
a(2) = 3: -1^2 + 2^2 = 3.
a(7) = 0: 1^2 + 2^2 - 3^2 + 4^2 - 5^2 - 6^2 + 7^2 = 0.
MAPLE
b:= proc(n, i) option remember; (m-> n<=m and (n=m or
b(abs(n-i^2), i-1) or b(n+i^2, i-1)))(i*(i+1)*(2*i+1)/6)
end:
g:= proc(n) option remember; local k; for k while not b(n, k) do od; k end:
a:= proc(n) option remember; local k; for k from 0 while not g(k)=n do od; k end:
seq(a(n), n=1..47);
CROSSREFS
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Dec 30 2025
STATUS
approved