regex = re.compile('(.+ .+)( \\1)+')
match = regex.search('3 0 5 5 1 5 1 6 8')
match.group(0)
match.group(1)
match.start()
match = regex.search('2 0 6 3 1 6 3 1 6 3 1')
match.group(1)
Detecting a repeating cycle in a sequence of numbers (python)