Find the sum of all of the three digit positive integers with three distinct digits.
Obviously this is trivial to solve with a program or just a spreadsheet, but here's one way to reason it out:
There are 100 threedigit positive integers beginning with x (where x is any integer from 1 through 9). Ten of them will have an x in the tens place. A further nine of them will have an x in the ones place. And a further nine of them will have repeated digits (that aren't x) in the tens and ones places. So of the 100 integers beginning with x, 72 of them have all distinct digits.
There are 90 threedigit positive integers with an x in the tens place. Of those, ten will have an x in the hundreds place; a further eight will have an x in the ones place; and a final eight will have repeated nonx digits in the hundreds and ones places. So the remaining 64 of them have all distinct digits.
The same argument in the last paragraph applies to the ones place, so 64 threedigit integers with an x in the ones place will have all distinct digits.
Since x will take all values from 1 to 9 (and the sum of 1..9 = 45) the sum of all the cases we've enumerated can be expressed as 45 * 72 * 100 + 45 * 64* 10 + 45 * 64 * 1 = 355,680.

Posted by tomarken
on 20240328 07:50:15 