OFFSET
0,3
LINKS
Robert Israel, Table of n, a(n) for n = 0..10000
MAPLE
A[0]:= 0:
for n from 1 to 100 do
if A[n-1]>2*n then A[n]:= A[n-1]-n else A[n]:= A[n-1]+n fi
od:
seq(A[i], i=0..100); # Robert Israel, Nov 16 2016
MATHEMATICA
s={0}; a=0; Do[a=a+If[a>2n, -n, n]; AppendTo[s, a], {n, 200}]; s
nxt[{n_, a_}]:={n+1, If[a>2(n+1), a-n-1, a+n+1]}; NestList[nxt, {0, 0}, 70][[All, 2]] (* Harvey P. Dale, Feb 28 2022 *)
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Zak Seidov, Mar 08 2007
STATUS
approved