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