Objective
You're on a nonempty list of integers that wraps around. You start at the leftmost entry of the list, and keep jumping to the right to the amount of the integer entry you're at.
Eventually, you'll end up in a cycle. The objective is to output the length of this cycle.
I/O format
Provided that the inputted list has \$n\$ entries, each entry \$m\$ is assumed to satisfy \$0 \leq m < n\$. Otherwise flexible.
Examples
Input, Output
[0], 1
[0, 1, 2], 1
[1, 0, 2], 1
[1, 1, 2], 2
[2, 2, 2, 2], 2
[2, 3, 2, 1], 2
[3, 3, 3, 2], 3
[1, 1, 1, 1], 4
Worked Example
[1, 2, 3, 2]
^
[1, 2, 3, 2]
^
[1, 2, 3, 2]
^
[1, 2, 3, 2]
^
Cycle detected; halt. The output is: 2.