OFFSET
0,3
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..10000
N. J. A. Sloane, Open Problems in the OEIS, Slides of Guest Lecture given in Doron Zeilberger's Experimental Mathematics Class, Rutgers University, May 2, 2016.
MAPLE
a:= proc(n) option remember; `if`(n<2, 1,
a(n-1)+a(irem((a(n-1)-1), n)))
end:
seq(a(n), n=0..50); # Alois P. Heinz, Apr 08 2016
MATHEMATICA
a[0] = a[1] = 1; a[n_] := a[n] = # + a@ Mod[# - 1, n] &@ a[n - 1]; Array[a, 47, 0] (* Michael De Vlieger, Apr 08 2016 *)
PROG
(PARI) lista(nn) = {va = vector(nn); print1(va[1] = 1, ", "); print1(va[2] = 1, ", "); for (n=3, nn, va[n] = va[n-1] + va[((va[n-1]-1) % (n-1))+1]; print1(va[n], ", "); ); } \\ Michel Marcus, Apr 08 2016
(Python)
from sympy.core.cache import cacheit
@cacheit
def a(n): return 1 if n<2 else a(n - 1) + a((a(n - 1) - 1)%n)
print([a(n) for n in range(51)]) # Indranil Ghosh, Aug 06 2017
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Christian Perfect, Jan 28 2016
STATUS
approved