cp's OEIS Frontend

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.

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.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

a(0) and a(4) are both zero. Are there any other zero values? - N. J. A. Sloane, Sep 12 2019

Crossrefs

Programs

  • 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 *)