|
|
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.
|
|
15
|
|
|
0, 1, 5, 14, 30, 5, 41, 90, 26, 107, 7, 128, 272, 103, 299, 74, 330, 41, 365, 4, 404, 845, 361, 890, 314, 939, 263, 992, 208, 1049, 149, 1110, 86, 1175, 19, 1244, 2540, 1171, 2615, 1094, 2694, 1013, 2777, 928, 2864, 839, 2955, 746, 3050, 649, 3149
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
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
'Easy Recamán transform' of the squares. - Daniel Forgues, Oct 25 2019
|
|
LINKS
|
|
|
MAPLE
|
a:= proc(n) option remember; `if`(n<0, 0,
((s, t)-> s+`if`(s<t, t, -t))(a(n-1), n^2))
end:
|
|
MATHEMATICA
|
a[0] = 0;
a[n_] := a[n] = a[n-1] + If[a[n-1] < n^2, n^2, -n^2];
|
|
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
|
Cf. A053461 ('Recamán transform' of the squares).
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|