1640.41 – Find the Number!

Find the smallest number nn such that nn is divisible by 23, n+1n+1 is divisible by 29, and both nn and n+1n+1 contain only the digits '1' and '2'.


Probably the best way to go at this is to generate the list of all five-digit numbers whose digits are either 1's or 2's. There are 32 such numbers (why?). The smallest is 11111 and the largest is 22222. Once you have the list, perhaps on a spreadsheet, start dividing each by 23 and by 29, and hunt for the numbers that are one apart.

The answer is n=12121=23527n = 12121 = 23 \cdot 527, and n+1=12122=29418.n+ 1 = 12122 = 29 \cdot 418.