OFFSET
0,3
COMMENTS
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
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
'Easy Recamán transform' of the squares. - Daniel Forgues, Oct 25 2019
LINKS
Tomas Rokicki, Table of n, a(n) for n = 0..20000
MAPLE
a:= proc(n) option remember; `if`(n<0, 0,
((s, t)-> s+`if`(s<t, t, -t))(a(n-1), n^2))
end:
seq(a(n), n=0..70); # Alois P. Heinz, Jan 11 2020
MATHEMATICA
a[0] = 0;
a[n_] := a[n] = a[n-1] + If[a[n-1] < n^2, n^2, -n^2];
a /@ Range[0, 50] (* Jean-François Alcover, Apr 11 2020 *)
PROG
(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)
CROSSREFS
KEYWORD
nonn
AUTHOR
Amarnath Murthy, Oct 29 2002
EXTENSIONS
More terms from Ralf Stephan, Mar 20 2003
a(0)=0 prepended, at the suggestion of Allan C. Wechsler, by N. J. A. Sloane, Aug 31 2019
Offset set to 0, to cohere with previous action of N. J. A. Sloane, by Allan C. Wechsler, Sep 08 2019
STATUS
approved