cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A053461 a(0) = 0; a(n) = a(n-1) - n^2 if positive and new, otherwise a(n) = a(n-1) + n^2.

This page as a plain text file.
%I A053461 #34 Oct 14 2022 08:52:42
%S A053461 0,1,5,14,30,55,19,68,4,85,185,64,208,39,235,10,266,555,231,592,192,
%T A053461 633,149,678,102,727,51,780,1564,723,1623,662,1686,597,1753,528,1824,
%U A053461 455,1899,378,1978,297,2061,212,2148,123,2239,4448,2144,4545
%N A053461 a(0) = 0; a(n) = a(n-1) - n^2 if positive and new, otherwise a(n) = a(n-1) + n^2.
%C A053461 'Recamán transform' (see A005132) of the squares.
%H A053461 Samuel Harkness, <a href="/A053461/b053461.txt">Table of n, a(n) for n = 0..10000</a>
%H A053461 Nick Hobson, <a href="/A053461/a053461.py.txt">Python program for this sequence</a>
%H A053461 <a href="/index/Rea#Recaman">Index entries for sequences related to Recamán's sequence</a>
%t A053461 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 *)
%o A053461 (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
%Y A053461 Cf. A076042 ('Easy Recamán transform' of the squares), A064365 ('Recamán transform' of the primes).
%K A053461 nonn,hear
%O A053461 0,3
%A A053461 _N. J. A. Sloane_, Feb 09 2002