login
a(1) = 1 and a(n) = prime(a(n-1)+n) mod (a(n-1)+n).
0

%I #8 Dec 04 2023 13:46:01

%S 1,2,1,1,1,3,9,8,8,7,7,10,14,23,11,22,11,22,15,9,23,17,13,9,3,22,31,

%T 41,69,28,41,2,9,19,35,69,47,14,29,2,19,39,11,37,11,41,17,53,47,24,4,

%U 39,19,2,41,24,14,71,83,108,164,73,89,118,178,85,121,184,89,142,25,24,24

%N a(1) = 1 and a(n) = prime(a(n-1)+n) mod (a(n-1)+n).

%C 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.

%C 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).

%H Eric Angelini, <a href="https://cinquantesignes.blogspot.com/2023/10/a-fractal-sequence-by-gk.html">A fractal sequence by GK</a>, Personal blog "Cinquante signes", Oct 2023.

%F a(1) = 1, a(n) = prime(a(n-1)+n) mod (a(n-1)+n).

%e a(2) = 2 because a(1) = 1 and prime(1+2) mod (1+2) is 5 mod 3.

%e a(7) = 9 because a(6) = 3 and prime(3+7) mod (3+7) is 29 mod 10.

%t a[1] = 1;

%t a[n_] := a[n] = Mod[Prime[a[n - 1] + n], a[n - 1] + n]; Array[a, 100]

%o (PARI) a(n) = if (n==1, 1, my(x=a(n-1)+n); prime(x) % x); \\ _Michel Marcus_, Oct 29 2023

%Y Cf. A004648.

%K nonn

%O 1,2

%A _Giorgos Kalogeropoulos_ and _Eric Angelini_, Oct 29 2023