Last New Year's Eve, glasses shaped like the number "2009" with lenses in place of the two zeros were very much in fashion. In order to make similar glasses, it is necessary that the number representing the year contain two or more consecutive zeros (for example 3500 works, 2010 does not). How many years between the year 999 and the year 9999 contain two or more consecutive zeros in their writing?
Problem 831
Pick one
Official solution
Solution:
Note that if instead we had counted the number of ways in which one can substitute a digit from 1 to 9 for and a digit from 0 to 9 for in the two patterns and , we would have obtained an incorrect result because we would have counted twice the years of the form .
The problem can be solved with an almost identical reasoning also using the inclusion-exclusion principle.