OFFSET
1,2
COMMENTS
In each step we take the (a(n-1)+n)th prime and we find the remainder when we divide it with a(n-1)+n.
If we examine the plot, we notice some rectangles and we get the same fractal pattern every time we scale ~2.4 times. Why does this happen? (See Angelini's link).
LINKS
Eric Angelini, A fractal sequence by GK, Personal blog "Cinquante signes", Oct 2023.
FORMULA
a(1) = 1, a(n) = prime(a(n-1)+n) mod (a(n-1)+n).
EXAMPLE
a(2) = 2 because a(1) = 1 and prime(1+2) mod (1+2) is 5 mod 3.
a(7) = 9 because a(6) = 3 and prime(3+7) mod (3+7) is 29 mod 10.
MATHEMATICA
a[1] = 1;
a[n_] := a[n] = Mod[Prime[a[n - 1] + n], a[n - 1] + n]; Array[a, 100]
PROG
(PARI) a(n) = if (n==1, 1, my(x=a(n-1)+n); prime(x) % x); \\ Michel Marcus, Oct 29 2023
CROSSREFS
KEYWORD
nonn
AUTHOR
Giorgos Kalogeropoulos and Eric Angelini, Oct 29 2023
STATUS
approved