login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A053461 a(0) = 0; a(n) = a(n-1) - n^2 if positive and new, otherwise a(n) = a(n-1) + n^2. 4
0, 1, 5, 14, 30, 55, 19, 68, 4, 85, 185, 64, 208, 39, 235, 10, 266, 555, 231, 592, 192, 633, 149, 678, 102, 727, 51, 780, 1564, 723, 1623, 662, 1686, 597, 1753, 528, 1824, 455, 1899, 378, 1978, 297, 2061, 212, 2148, 123, 2239, 4448, 2144, 4545 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
COMMENTS
'Recamán transform' (see A005132) of the squares.
LINKS
MATHEMATICA
a = {0, 1}; Do[If[a[[-1]] - n^2 >= 0 && Position[a, a[[-1]] - n^2] == {}, a = Append[a, a[[-1]] - n^2], a = Append[a, a[[-1]] + n^2]], {n, 2, 49}]; Print[a] (* Samuel Harkness, Sep 20 2022 *)
PROG
(PARI) lista(nn) = {my(va = vector(nn)); va[1] = 1; my(sa = Set(va)); for (n=2, nn, my(x = va[n-1] - n^2); if ((x>0) && !setsearch(sa, x), va[n] = x, va[n] = va[n-1] + n^2); sa = Set(va); ); concat(0, va); } \\ Michel Marcus, Sep 26 2022
CROSSREFS
Cf. A076042 ('Easy Recamán transform' of the squares), A064365 ('Recamán transform' of the primes).
Sequence in context: A162208 A161698 A049791 * A136135 A231673 A211653
KEYWORD
nonn,hear
AUTHOR
N. J. A. Sloane, Feb 09 2002
STATUS
approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 27 20:19 EDT 2024. Contains 372020 sequences. (Running on oeis4.)