Is this for a competition, or homework?
Grade 9 and 1212121212 is one example but the key is to find it out in the shortest amount of time.... Challenging the problem with brute force isn't gonna be logical. I was wondering if there would be an easier way such as any tricks, using algebra, etc.
here is a hint, think in terms of pairs of digits.
here are two relevent facts for this problem:
A) every time you get a 2 the next pair of digits must be 32 or 12. in either case, you return to the number two after the next pair of digits.
B) the number must start either 12...., or 32....., or 2.... you can analyse each of these cases seperately using rule (A).