OFFSET
0,2
EXAMPLE
The 7th prime, 17, is congruent to 3 (mod 7). So a(7) = a(3) + 1 = 4 + 1 = 5.
MAPLE
a[0]:=1: for n from 1 to 125 do a[n]:=1+a[ithprime(n) mod n] od: seq(a[n], n=0..125); # Emeric Deutsch, Mar 25 2007
MATHEMATICA
f[l_List] := Block[{n = Length[l]}, Append[l, l[[Mod[Prime[n], n] + 1]] + 1]]; Nest[f, {1}, 105] (* Ray Chandler, Mar 25 2007 *)
PROG
(PARI) a(n)={k=1; if(n>0, k=a(prime(n)%n)+1); k; } \\ Jinyuan Wang, Feb 01 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
Leroy Quet, Mar 21 2007
EXTENSIONS
Extended by Ray Chandler and Emeric Deutsch, Mar 25 2007
STATUS
approved