I have a list of lists of numbers:
As you can see, they eventually cycle, but not immediately. I need a function that will take a list of lists of numbers like this and return the cycle length (in this case $2$), and I need it to be as fast as possible.
The naive way is to take the first element that appears more than once, find it's first two positions in the list and subtract them:
findCycle[list_] := (tbl = Flatten[Position[list, Select[list, (Count[list, #] > 1 &)][]]]; tbl[] - tbl[])
But this is slower than I'd like, and it errors when there is not a cycle. I'll be running this on ~25000 lists of 500 items.