Evaluate the sum of all zeroless 9 digit pandigital numbers.
What if zero was a must i.e. 10 digit numbers?
There are 9! 9-digit pandigital numbers (without zeros).
In each position each of the 9 possible digits appears 1/9 of the time, i.e., 8! times.
The total of the 9 digits is 45, so 45*8! total occurs at each of the nine positions, and the sum sought is 45*8!*111111111 = 201,599,999,798,400.
When zeros are allowed it's trickier, as 0000000984, for example is not really a 9-digit number though it's masquerading as one. It's really a 3-digit number: 984.
There are 9*9! legitimate 10-digit pandigitals.
The average contribution of the leftmost digit is 5000000000 (i.e., 5*10^9) for a total of 5*10^9 * 9*9!.
The average contribution of each of the remaining digits is 4.5 * 10^i where i ranges from 8 down to zero:
450000000
45000000
4500000
450000
45000
4500
450
45
4.5
but each one is multiplied by 9*9!, the number of such pandigitals. Remember, at the top of this list is 5000000000, to be included in the total that's to be multiplied by 9*9!
The sum of the above 1+9=10 numbers is 5499999999.5; and 9*9! is 3265920, so the answer is their product, 17,962,559,998,367,040.
This latter answer differs from Jer's, which calculates out to 17,942,399,998,387,200.
Oh, the calculations for part 2:
>> vpa(5499999999.5)*9*factorial(vpa(9))
ans =
17962559998367040.0
>> vpa(45*factorial(9)*1111111111) - vpa(45)*factorial(8)*111111111
ans =
17942399998387200.0
Edited on January 18, 2022, 9:33 am
|
Posted by Charlie
on 2022-01-18 09:27:45 |