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.
%I A076042 #58 Nov 18 2024 09:44:13 %S A076042 0,1,5,14,30,5,41,90,26,107,7,128,272,103,299,74,330,41,365,4,404,845, %T A076042 361,890,314,939,263,992,208,1049,149,1110,86,1175,19,1244,2540,1171, %U A076042 2615,1094,2694,1013,2777,928,2864,839,2955,746,3050,649,3149 %N A076042 a(0) = 0; thereafter a(n) = a(n-1) + n^2 if a(n-1) < n^2, otherwise a(n) = a(n-1) - n^2. %C A076042 Does not return to zero within first 2^25000 =~ 10^7525 terms. Define an epoch as an addition followed by a sequence of (addition, subtraction) pairs. The first epoch has length 1 (+), the second 3 (++-), the third 5 (++-+-), and so forth (cf. A324792). The epoch lengths increase geometrically by about the square root of 3, and the value at the end of each epoch is the low value in the epoch. These observations lead to the Python program given. - _Tomas Rokicki_, Aug 31 2019 %C A076042 Using the Maple program in A324791, I confirmed that a(n) != 0 for 0 < n < 10^2394. See the a- and b-files in A325056 and A324791. - _N. J. A. Sloane_, Oct 03 2019 %C A076042 'Easy Recamán transform' of the squares. - _Daniel Forgues_, Oct 25 2019 %H A076042 Tomas Rokicki, <a href="/A076042/b076042.txt">Table of n, a(n) for n = 0..20000</a> %p A076042 a:= proc(n) option remember; `if`(n<0, 0, %p A076042 ((s, t)-> s+`if`(s<t, t, -t))(a(n-1), n^2)) %p A076042 end: %p A076042 seq(a(n), n=0..70); # _Alois P. Heinz_, Jan 11 2020 %t A076042 a[0] = 0; %t A076042 a[n_] := a[n] = a[n-1] + If[a[n-1] < n^2, n^2, -n^2]; %t A076042 a /@ Range[0, 50] (* _Jean-François Alcover_, Apr 11 2020 *) %o A076042 (PARI) v=vector(50); v[1]=1; for(n=2,50,if(v[n-1]<n^2,v[n]=v[n-1]+n^2,v[n]=v[n-1]-n^2)); print(v) %Y A076042 Cf. A076039, A003462, A076041, A046901. %Y A076042 See also A325056, A324791, A324792. %Y A076042 Cf. A053461 ('Recamán transform' of the squares). %Y A076042 Cf. A000290, A008344, A008345. %K A076042 nonn,look %O A076042 0,3 %A A076042 _Amarnath Murthy_, Oct 29 2002 %E A076042 More terms from _Ralf Stephan_, Mar 20 2003 %E A076042 a(0)=0 prepended, at the suggestion of _Allan C. Wechsler_, by _N. J. A. Sloane_, Aug 31 2019 %E A076042 Offset set to 0, to cohere with previous action of _N. J. A. Sloane_, by _Allan C. Wechsler_, Sep 08 2019