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.

A125204 a(0)=0, a(1)=1; and a(n) = a(n-1) + a(a(n-1) mod n) for n>=2.

Original entry on oeis.org

0, 1, 2, 4, 4, 8, 10, 14, 24, 34, 38, 46, 84, 94, 132, 216, 240, 242, 266, 266, 276, 280, 520, 652, 656, 666, 906, 1122, 1124, 1644, 2300, 2310, 2320, 2358, 2442, 3564, 3564, 3648, 3648, 3928, 3952, 4192, 6634, 6718, 9018, 9284, 12932, 12946, 15388, 15390
Offset: 0

Views

Author

Leroy Quet, Jan 13 2007

Keywords

Examples

			a(14) = a(13) + a(a(13) mod 14) = 94 + a(94 mod 14) = 94 + a(10) = 94 + 38 = 132.
		

Programs

  • Maple
    f:=proc(n) option remember;
    if n <= 1 then n else f(n-1)+f(f(n-1) mod n); fi; end;
    [seq(f(n),n=0..32)]; # N. J. A. Sloane, May 04 2016
  • Mathematica
    f[l_List] := Append[l, l[[ -1]] + l[[Mod[l[[ -1]], Length[l]] + 1]]];Nest[f, {0, 1}, 50] (* Ray Chandler, Jan 23 2007 *)
    l = {0, 1}; Do[x = l[[n]] + l[[Mod[l[[n]], n] + 1]]; AppendTo[l, x], {n, 2, 50}]; l (* Ryan Propper, Jan 24 2007 *)
  • Python
    from sympy.core.cache import cacheit
    @cacheit
    def a(n): return n if n<2 else a(n - 1) + a(a(n - 1)%n)
    print([a(n) for n in range(51)]) # Indranil Ghosh, Aug 07 2017

Extensions

Extended by Ray Chandler and Robert G. Wilson v, Jan 23 2007
More terms from Ryan Propper, Jan 24 2007