login
A363447
a(0) = 0; a(n) = a(a(n-1))-1 mod (n+1) for all n >= 1.
1
0, 1, 0, 3, 2, 5, 4, 1, 0, 9, 8, 11, 10, 7, 0, 15, 14, 17, 16, 13, 6, 3, 2, 23, 22, 1, 0, 27, 26, 29, 28, 25, 0, 33, 32, 35, 34, 31, 24, 21, 2, 41, 40, 1, 0, 45, 44, 47, 46, 43, 0, 51, 50, 53, 52, 49, 42, 39, 20, 5, 4, 1, 0, 63, 62, 65, 64, 61, 0, 69, 68, 71
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
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
Sequence in context: A178844 A210714 A343782 * A371905 A371908 A143956
KEYWORD
nonn,easy,look
AUTHOR
Curtis Bechtel, Jun 02 2023
STATUS
approved