Call a number huge if the sum of its digits is greater than or equal to 2 3 . There are 3 5 huge three-digit numbers, and there are 2 2 0 5 huge four-digit numbers. If N is the number of huge five-digit numbers, what are the last three digits of N ?
This problem is posed by Michael T .
Details and assumptions
The number 1 2 = 0 1 2 is a 2-digit number, not a 3-digit number.
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
As Nathan said: There are 1 0 0 , 0 0 0 5 -tuples of digits, of which 5 0 , 0 0 0 have a sum over 2 3 (symmetry by taking 9 minus each digit). Of those, 3 5 begin with 0 0 . Furthermore, 2 2 0 5 begin with 0 x , where x = 0 . Thus, 2 2 0 5 + 3 5 = 2 2 4 0 begin with 0 . Therefore, 5 0 , 0 0 0 − 2 2 4 0 begin with x , where x = 0 , so those 5 0 , 0 0 0 − 2 2 4 0 correspond to valid, huge 5 -digit numbers. The last three digits of the above number is the same as that of 1 , 0 0 0 − 2 4 0 , or 7 6 0 .
oh my god .,this problem makes my nose bleed,.,.,.,can you make it easier the next time around.,.
Ooh.. ugly. This was actually a tournament problem on Aops. I ended up doing a bash like yours, although not nearly as ugly. It turns out there is quite a nice solution, however. There is a reason they give you the number of 3 and 4 digit huge numbers!
Quick and Dirty solution:
The generating function for the 5 digit numbers is ( x + x 2 + ⋯ + x 9 ) ( 1 + x + ⋯ + x 9 ) 4 . We multiply this out, preferably with a calculator like Wolfram Alpha, then sum the coefficients of x 2 3 → x 4 5 and get 4 7 7 6 0 . The last three digits of this is 7 6 0 .
The number of positive integers below 100,000 who's digits add up to the numbers 23-45 is equal to those that add up to 0-22. All of them add up to 0-45 so half of them will add up to 23-45. This means that 50,000=100,000/2 is the number of integers below 100,000 that add up to the numbers 23-45 this of course counts those that are 4 digit and 3 digit and 2 digit and 1 digit numbers. So we must subtract those out. 50,000-2205-35-0-0=47,760 . Therefore the answer is 760.
Hint: 23 is a specially chosen number.
Problem Loading...
Note Loading...
Set Loading...
I apologise for the length of this solution, but I simply haven't found any elegant shortcut.
The stars and bars technique and the inclusion-exclusion principle are keys to my procedure. We first find a general solution, and then subtract all the solutions containing digits ≥ 1 0 and all the solutions where the first digit is 0 .
We have x 1 + x 2 + x 3 + x 4 + x 5 ≥ 2 3 .
The maximum possible sum is 4 5 when all the digits are 9 .
Instead of finding all the solutions between 2 3 and 4 5 separately, it is useful to notice that the inequality
x 1 + x 2 + x 3 + x 4 + x 5 ≤ k ,
where k is any integer, may be transformed to an equation by introducing a dummy-variable x 6 , which is not subjected to any restrictions:
x 1 + x 2 + x 3 + x 4 + x 5 + x 6 = k .
(The pattern in a Pascal triangle will confirm this result).
To find the number of solutions to the original problem, the idea is then to find the number of solutions to x 1 + x 2 + x 3 + x 4 + x 5 ≤ 4 5 and subtract the number of solutions to x 1 + x 2 + x 3 + x 4 + x 5 ≤ 2 2 .
This is equivalent to finding the number of solutions to x 1 + x 2 + x 3 + x 4 + x 5 + x 6 = 4 5 and subtracting the number of solutions to x 1 + x 2 + x 3 + x 4 + x 5 + x 6 = 2 2 .
The solution has two main parts, A) and B).
A) Let us first find the number of solutions adding up to 4 5 .
Without restrictions on the values of the digits, the solution is
( 5 5 0 ) .
From this number we must subtract all digits ≥ 1 0 , and all solutions containing the first digit as 0 .
1) Subtracting the digits ≥ 1 0 :
In order not to count any of our cases more than once, we use the inclusion-exclusion principle, i.e.:
general solution − ( number of single digits ≥ 1 0 ) − number of double digits ≥ 1 0 + number of triple digits ≥ 1 0 − ... + ... ) .
Choosing first one digit x i ≥ 1 0 , the equation is now transformed into
x 1 + x 2 + x 3 + x 4 + x 5 + x 6 = 3 5
which has ( 5 4 0 ) solutions.
Since there are ( 1 5 ) ways of choosing one digit, we have ( 1 5 ) ( 5 4 0 ) ways of subtracting all the 1 0 's.
However, we have now subtracted too many, for there are cases were two digits are higher than ten at the same time, and they should be counted only once. With two digits higher than 1 0 , the equation is transformed to
x 1 + x 2 + x 3 + x 4 + x 5 + x 6 = 2 5
which has the solution ( 5 3 0 ) .
There are ( 2 5 ) ways of choosing two digits at the time, and thus we have ( 2 5 ) ( 5 3 0 ) to subtract from the first case.
Having now removed too many cases, we must add the triple cases, and then subtract quadruple cases, etc.
Continuing like this until it is no longer possible to reduce the equation further by 1 0 , we find that the total number of digits ≥ 1 0 to be subtracted from from the general solution is:
( 1 5 ) ( 5 4 0 ) − ( 2 5 ) ( 5 3 0 ) + ( 3 5 ) ( 5 2 0 ) − ( 4 5 ) ( 5 1 0 ) = 2 0 1 8 7 6 0 .
2) We can now go on to subtract also the solutions with first digit 0 :
If we set x 1 = 0 , the equation transforms to
x 2 + x 3 + x 4 + x 5 + x 6 = 4 5 .
Using the same procedure as for the previous case, but now with one less variable, we find the general solution and subtract the cases where digits >=10. This produces:
( 4 4 9 ) − ( ( 1 4 ) ( 4 3 9 ) − ( 2 4 ) ( 4 2 9 ) + ( 3 4 ) ( 4 1 9 ) − ( 4 4 ) ( 4 9 ) ) = 1 0 0 0 0 .
The number of solutions to x 1 + x 2 + x 3 + x 4 + x 5 + x 6 = 4 5 is then ( 5 5 0 ) − 2 0 1 8 7 6 0 − 1 0 0 0 0 = 9 0 0 0 0 .
B) Following the exact same procedure for the case x 1 + x 2 + x 3 + x 4 + x 5 + x 6 = 2 2 , the number of solutions is now found to be:
( 5 2 7 ) − ( ( 1 5 ) ( 5 1 7 ) − ( 2 5 ) ( 5 7 ) ) − ( ( 4 2 6 ) − ( ( 1 4 ) ( 4 1 6 ) − ( 2 4 ) ( 4 6 ) ) = 4 2 2 4 0 .
By subtracting the results B from A , we find the total number of solutions to x 1 + x 2 + x 3 + x 4 + x 5 ≥ 2 3 to be 9 0 0 0 0 − 4 2 2 4 0 = 4 7 7 6 0 .
The last three digits are 7 6 0