OFFSET
0,4
COMMENTS
Question: Does every nonnegative integer appear in the sequence? Furthermore, does every nonnegative integer appear an infinite number of times?
LINKS
Curtis Bechtel, Table of n, a(n) for n = 0..10000
EXAMPLE
For n = 1, we have a(1) = a(a(0))-1 mod 2 = a(0)-1 mod 2 = 0-1 mod 2 = 1.
For n = 20, assume we already know that a(19) = 13 and a(13) = 7. Then a(20) = a(a(19))-1 mod 21 = a(13)-1 mod 21 = 6.
For n = 23, assume we already know that a(22) = 2 and a(2) = 0. Then a(23) = a(a(22))-1 mod 24 = a(2)-1 mod 24 = -1 mod 24 = 23.
MATHEMATICA
a[0]:=0; a[n_]:=a[n]=Mod[a[a[n-1]]-1, n+1]; Array[a, 72, 0]
PROG
(Python)
a = [0]
for i in range(1, 100):
a.append((a[a[i - 1]] - 1) % (i + 1))
CROSSREFS
KEYWORD
AUTHOR
Curtis Bechtel, Jun 02 2023
STATUS
approved