On the blackboard there is written a 17-digit number made up only of 1s and 2s. Paolo comes in and rewrites the number in reverse order, lining it up under the previous one. Gianni comes in and writes under each column the maximum digit that appears in that column. Alberto comes in and writes under each column the minimum digit that appears in that column, then erases the first two rows. Carla comes in and finds written the numbers 12212212221221221 and 11211111211111211, and is told what Paolo, Gianni, and Alberto did. How many different numbers could have been written on the blackboard as the first number?
Problem 1804
Official solution
Solution:
The answer is . Before Alberto erases the first two rows, in column () there appear the digit in position , the digit in the symmetric position , the maximum between the two, the minimum between the two. When the maximum and the minimum coincide, the digit in position and the digit in the symmetric position are equal. This happens in columns , necessarily in column , then symmetrically in positions . In these positions the digits are certainly , respectively. In the other pairs of symmetric positions, they are in one and in the other. Therefore the numbers that could have given rise to the two rows that Carla finds on the blackboard were .