stop counting when the codes start repeating themselves.