The way you detect repetition is flawed, I'll get a number sequence like so:
114 - 60 - 456 - 240 - 480 - 288 - 576 - 480 - 288 - 576 - 480 - 288... etc., repeating 288, 576, and 480, but the entire thing is red, as though it didn't repeat at all. I imagine it's looking for the next time it sees the value 114 followed by 60... and so on.
2013/12/30