The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A098141 a(1)=1, then if n not a square a(n)=a(n-1) + n, if n a square then a(n)= a(n-1) - n. 2
 1, 3, 6, 2, 7, 13, 20, 28, 19, 29, 40, 52, 65, 79, 94, 78, 95, 113, 132, 152, 173, 195, 218, 242, 217, 243, 270, 298, 327, 357, 388, 420, 453, 487, 522, 486, 523, 561, 600, 640, 681, 723, 766, 810, 855, 901, 948, 996, 947, 997, 1048, 1100, 1153, 1207, 1262, 1318 (list; graph; refs; listen; history; text; internal format)
 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 Sequence in context: A171884 A339557 A226940 * A175458 A135598 A244619 Adjacent sequences:  A098138 A098139 A098140 * A098142 A098143 A098144 KEYWORD easy,nonn AUTHOR Pierre CAMI, Sep 28 2004 STATUS approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified April 17 11:48 EDT 2021. Contains 343064 sequences. (Running on oeis4.)