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
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 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
LINKS
EXAMPLE
a(14) = a(13) + a(a(13) mod 14) = 94 + a(94 mod 14) = 94 + a(10) = 94 + 38 = 132.
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 *)
PROG
(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
CROSSREFS
Sequence in context: A073117 A342695 A039879 * A241386 A265204 A073420
KEYWORD
nonn
AUTHOR
Leroy Quet, Jan 13 2007
EXTENSIONS
Extended by Ray Chandler and Robert G. Wilson v, Jan 23 2007
More terms from Ryan Propper, Jan 24 2007
STATUS
approved

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 March 29 05:48 EDT 2024. Contains 371265 sequences. (Running on oeis4.)