Inside count_cycles we currently rely on an index space p being registered:
If it isn't, we're getting an error here due to usage of an unknown index space.
We should find a way to mark a given position in the input sequence without having to overwrite it with a "null" dummy value. This would allow us to work on ranges without the need to copy/mutate them and it would also eliminate the need for this dummy index space.