login
A330249
a(0) = 0; for n > 0, a(n) = n + a((Sum_{k=0..n-1} a(k)) mod n).
2
0, 1, 3, 4, 4, 8, 9, 8, 16, 25, 26, 19, 16, 38, 39, 24, 16, 18, 22, 38, 59, 45, 81, 61, 28, 41, 67, 66, 95, 37, 69, 112, 40, 71, 50, 147, 183, 77, 75, 120, 62, 91, 119, 104, 94, 116, 55, 63, 70, 196, 145, 75, 92, 91, 170, 110, 176, 177, 241, 109
OFFSET
0,3
LINKS
EXAMPLE
a(1) = 1 + a(0 mod 1) = 1.
a(2) = 2 + a((0+1) mod 2) = 3.
a(3) = 3 + a((0+1+3) mod 3) = 4.
a(4) = 4 + a((0+1+3+4) mod 4) = 4.
MATHEMATICA
a[0] = 0; a[n_] := a[n] = n + a[Mod[Sum[a[k], {k, 0, n-1}], n]]; Array[a, 100, 0] (* Amiram Eldar, Dec 07 2019 *)
PROG
(PARI) lista(nn) = {my(v=vector(nn+1), s=0); v[1]=0; for(n=1, nn, v[n+1]=n+v[s%n+1]; s+=v[n+1]); v; } \\ Jinyuan Wang, Dec 07 2019
CROSSREFS
Sequence in context: A339827 A240875 A127735 * A075550 A292729 A328989
KEYWORD
nonn
AUTHOR
Samuel B. Reid, Dec 06 2019
STATUS
approved