OFFSET
1,2
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
EXAMPLE
a(1)=1
As 2 not a square a(2)=1+2=3
As 3 not a square a(3)=3+3=6
As 4 is a square a(4)=6-4=2
MATHEMATICA
nxt[{n_, a_}]:={n+1, If[IntegerQ[Sqrt[n+1]], a-(n+1), a+(n+1)]}; NestList[nxt, {1, 1}, 60][[All, 2]] (* Harvey P. Dale, Jul 10 2017 *)
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Pierre CAMI, Sep 28 2004
STATUS
approved