Problem:
How many positive integers less than have at most two different digits?
Solution:
There are numbers with the desired property that are less than . Threedigit numbers with the property must have decimal representations of the form , or , where and are digits with and . There are
of the first type and of each of the other three. Four-digit numbers with the property must have decimal representations of the form , aaab, , or . There are of the first type and of each of the other seven. Thus there are a total of numbers with the desired property.
Count the number of positive integers less than that contain at least distinct digits. There are such 3-digit integers. The number of -digit integers that contain exactly distinct digits is because there are choices for the positions of the two digits that are the same, choices for the digit that appears in the first place, and and choices for the two other digits, respectively. The number of -digit integers that contain exactly distinct digits is . Thus there are positive integers less than that contain at least distinct digits, and there are integers with the desired property.
The problems on this page are the property of the MAA's American Mathematics Competitions