OFFSET
0,3
COMMENTS
LINKS
M. F. Hasler, Table of n, a(n) for n = 0..5000
EXAMPLE
Starting from a(0)=0 we add the square 1 to get a(1)=1, and since we can't yet subtract 2, we also add the next larger square 4, to get a(2)=5. Then we can subtract nonsquares 2, a(3)=3, and 3, a(4)=0. Now we must add the square 9 to get a(5)=9 before subtracting the nonsquare 5, a(6)=4. Since we can't subtract the nonsquare 6, we add the square 16, a(7)=20. And so on.
PROG
(PARI) {print1(a=0); c=1; p=2; for(n=1, 199, if(a>=p, a-=p; while(issquare(p++), ), a+=c^2; c++); print1(", "a))}
CROSSREFS
KEYWORD
nonn
AUTHOR
M. F. Hasler and Eric Angelini, Feb 24 2017
STATUS
approved