Recognizing and continuing repeating patterns