It was not apparent when I started working on the solution that it is easier to find how many numbers do not contain a 1, which struck me as a bit counter-intuitive.
We will find how many numbers contain no ones by eliminting the numbers with a 1 a coumn at a time. Consider first the numbers whose ones column is 1. They account for 1/10 of all the numbers, so if we eliminate them we are left with 9/10 of 1000 or 900 numbers. Now let’s go to the numbers whose tens column is a 1. If you think about it a moment, you will see that again they account for 1/10 of the remaining 900 numbers. So when we eliminate them we are left with .9 * 900 = 810 numbers. Similarly, eliminating the numbers whose hundreds column is a 1 leaves .9*810=729 numbers. Finally eliminating 1000 leaves 728 numbers with no ones, which means there are 1000 – 728 = 272 numbers with at least one 1.
Note that 729 = 9^3, For the numbers from 1 to 10^n, there are 10^n – 9^n + 1 numbers with at least one 1.