login
A008345
a(n+1) = a(n)-b(n+1) if a(n) >= b(n+1) else a(n)+b(n+1), where {b(n)} are the triangular numbers A000217.
4
0, 1, 4, 10, 0, 15, 36, 8, 44, 89, 34, 100, 22, 113, 8, 128, 264, 111, 282, 92, 302, 71, 324, 48, 348, 23, 374, 752, 346, 781, 316, 812, 284, 845, 250, 880, 214, 917, 176, 956, 136, 997, 94, 1040, 50, 1085, 4, 1132, 2308, 1083, 2358, 1032, 2410, 979, 2464, 924
OFFSET
0,3
COMMENTS
a(0) and a(4) are both zero. Are there any other zero values? - N. J. A. Sloane, Sep 12 2019
LINKS
Rémy Sigrist, Table of n, a(n) for n = 0..25000 (first 1001 terms from Franklin T. Adams-Watters)
MAPLE
A008345 := proc(n) option remember; if n = 1 then n-1 elif A008345(n-1) >= n*(n+1)/2 then A008345(n-1)-n*(n+1)/2 else A008345(n-1)+n*(n+1)/2; fi; end;
MATHEMATICA
nxt[{n_, a_}]:=Module[{tr=((n+1)(n+2))/2}, {n+1, If[a>=tr, a-tr, a+tr]}]; Transpose[NestList[nxt, {0, 0}, 50]][[2]] (* Harvey P. Dale, Jun 19 2013 *)
CROSSREFS
KEYWORD
nonn,easy
STATUS
approved