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.

This page as a plain text file.
%I A125204 #28 Jun 10 2020 10:50:27
%S A125204 0,1,2,4,4,8,10,14,24,34,38,46,84,94,132,216,240,242,266,266,276,280,
%T A125204 520,652,656,666,906,1122,1124,1644,2300,2310,2320,2358,2442,3564,
%U A125204 3564,3648,3648,3928,3952,4192,6634,6718,9018,9284,12932,12946,15388,15390
%N A125204 a(0)=0, a(1)=1; and a(n) = a(n-1) + a(a(n-1) mod n) for n>=2.
%H A125204 N. J. A. Sloane, <a href="/A125204/b125204.txt">Table of n, a(n) for n = 0..5000</a>
%e A125204 a(14) = a(13) + a(a(13) mod 14) = 94 + a(94 mod 14) = 94 + a(10) = 94 + 38 = 132.
%p A125204 f:=proc(n) option remember;
%p A125204 if n <= 1 then n else f(n-1)+f(f(n-1) mod n); fi; end;
%p A125204 [seq(f(n),n=0..32)]; # _N. J. A. Sloane_, May 04 2016
%t A125204 f[l_List] := Append[l, l[[ -1]] + l[[Mod[l[[ -1]], Length[l]] + 1]]];Nest[f, {0, 1}, 50] (* _Ray Chandler_, Jan 23 2007 *)
%t A125204 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 *)
%o A125204 (Python)
%o A125204 from sympy.core.cache import cacheit
%o A125204 @cacheit
%o A125204 def a(n): return n if n<2 else a(n - 1) + a(a(n - 1)%n)
%o A125204 print([a(n) for n in range(51)]) # _Indranil Ghosh_, Aug 07 2017
%K A125204 nonn
%O A125204 0,3
%A A125204 _Leroy Quet_, Jan 13 2007
%E A125204 Extended by _Ray Chandler_ and _Robert G. Wilson v_, Jan 23 2007
%E A125204 More terms from _Ryan Propper_, Jan 24 2007