OFFSET
1,1
LINKS
Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
Index entries for linear recurrences with constant coefficients, signature (2,-1).
FORMULA
a(n) = n + 37 for n >= 92.
EXAMPLE
5 = 1^2 + 2^2 and 25 = 3^2 + 4^2 are members, but 2 = 1^2 + 1^2 and 36 = 6^2 are not.
PROG
(PARI) upto(lim)={
my(x='x, A=prod(k=1, sqrt(lim), 1+x^(k^2), 1+O(x^floor(lim+1))), v=List());
A-=sum(k=0, sqrt(lim), x^(k^2));
for(n=5, lim, if(polcoeff(A, n), listput(v, n)));
Vec(v)
};
(Python)
from itertools import combinations
def aupto(lim):
s = [i*i for i in range(1, int(lim**.5)+2) if i*i <= lim]
ss = set(sum(c) for i in range(2, len(s)+1) for c in combinations(s, i))
return sorted(filter(lambda x: x <= lim, ss))
print(aupto(104)) # Michael S. Branicky, May 10 2021
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Charles R Greathouse IV, Jun 28 2011
STATUS
approved