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!)
A308576 a(n) = a(n-1) + a(a(n-1) mod n) + 1, a(0) = 1. 0
1, 3, 7, 11, 23, 35, 71, 75, 87, 159, 319, 321, 481, 483, 559, 583, 659, 1143, 1303, 1625, 1661, 1669, 3295, 3367, 3443, 4747, 5331, 5813, 6957, 12289, 13915, 19729, 20873, 22017, 23643, 24947, 49895, 51521, 71251, 122773, 123257, 123579, 124163, 127459, 152407 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,2
LINKS
FORMULA
a(n) = a(n-1) + a(a(n-1) mod n) + 1, a(0) = 1.
MAPLE
a:= proc(n) option remember; `if`(n=0, 1,
a(n-1) + a(a(n-1) mod n) + 1)
end:
seq(a(n), n=0..50); # Alois P. Heinz, Jul 08 2019
MATHEMATICA
a[0]=1; a[n_] := a[n] = a[n-1] + a[Mod[a[n-1], n]] + 1; Array[a, 50, 0] (* Amiram Eldar, Jul 08 2019 *)
PROG
(Java)
int f(int n) {
int[] a = new int[n + 1];
a[0] = 1;
for (int i = 1; i < n + 1; i++) a[i] = a[i - 1] + a[a[i - 1] % i] + 1;
return a[n];
}
(Haskell)
a 0 = 1
a n = (a (n - 1)) + (a (a (n - 1) `mod` n)) + 1
(PARI) getV(n, v) = if (!v[n+1], v[n+1] = getV(n-1, v) + getV(getV(n-1, v) % n, v) + 1); v[n+1];
lista(nn) = {my(v=vector(nn+1)); v[1] = 1; for (n=1, nn, v[n+1] = getV(n, v); ); v; } \\ Michel Marcus, Jun 09 2019
CROSSREFS
Sequence in context: A192614 A112715 A106935 * A116362 A090918 A139253
KEYWORD
nonn
AUTHOR
Artem Yashin, Jun 08 2019
EXTENSIONS
More terms from Michel Marcus, Jun 09 2019
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 April 23 22:36 EDT 2024. Contains 371917 sequences. (Running on oeis4.)