login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A125204 a(0)=0, a(1)=1; and a(n) = a(n-1) + a(a(n-1) mod n) for n>=2. 3

%I #28 Jun 10 2020 10:50:27

%S 0,1,2,4,4,8,10,14,24,34,38,46,84,94,132,216,240,242,266,266,276,280,

%T 520,652,656,666,906,1122,1124,1644,2300,2310,2320,2358,2442,3564,

%U 3564,3648,3648,3928,3952,4192,6634,6718,9018,9284,12932,12946,15388,15390

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

%H N. J. A. Sloane, <a href="/A125204/b125204.txt">Table of n, a(n) for n = 0..5000</a>

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

%p f:=proc(n) option remember;

%p if n <= 1 then n else f(n-1)+f(f(n-1) mod n); fi; end;

%p [seq(f(n),n=0..32)]; # _N. J. A. Sloane_, May 04 2016

%t 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 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 (Python)

%o from sympy.core.cache import cacheit

%o @cacheit

%o def a(n): return n if n<2 else a(n - 1) + a(a(n - 1)%n)

%o print([a(n) for n in range(51)]) # _Indranil Ghosh_, Aug 07 2017

%K nonn

%O 0,3

%A _Leroy Quet_, Jan 13 2007

%E Extended by _Ray Chandler_ and _Robert G. Wilson v_, Jan 23 2007

%E More terms from _Ryan Propper_, Jan 24 2007

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 20 11:40 EDT 2024. Contains 371838 sequences. (Running on oeis4.)