How many three digit numbers are there such that the sum of the digits in each number is 10.
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.
Why (12P2)?
how could it be : 12P2 ?
Log in to reply
The way to obtain 12C2 is to use stars and bars . You can imagine each solution to a + b + c = 1 0 as a configuration of 10 stars distributed into 3 distinct boxes. You can represent the 3 boxes as 2 "dividers" between boxes. For example the solution 3+2+5 can be represented as xxx|xx|xxxxx.
So the number of distinct solutions to this equation is equal to the number of configurations of 10 stars & 2 bars, which is ( 2 1 2 ) , which corresponds to choosing two places for the two bars from 12 places that can contain either star or bar. Got it?
What is 12P2???
To Dark Seer: The number of nonnegative integer solution in x1 + x2 + x3 + ... + xN = r is C(n+r-1, r)
Since we are only dealing with small numbers, we can essentially write down all options easily. The following is basically the same solution as B. Charlesworth's, but without invoking any star, nor bar.
We can begin by listing all possible triples having sum 1 0 : { ( 0 , 1 , 9 ) , ( 0 , 2 , 8 ) , ( 0 , 3 , 7 ) , ( 0 , 4 , 6 ) , ( 0 , 5 , 5 ) , ( 1 , 1 , 8 ) , ( 1 , 2 , 7 ) , ( 1 , 3 , 6 ) , ( 1 , 4 , 5 ) , ( 2 , 2 , 6 ) , ( 2 , 3 , 5 ) , ( 2 , 4 , 4 ) , ( 3 , 3 , 4 ) } . First we consider triples that do not contain 0 . There are two different cases: i) A triple consisting of three different numbers. This corresponds to 6 solutions, since there are six permutations of these digits. This gives 4 ⋅ 6 = 2 4 numbers. ii) A triple containing a number twice. In these cases, there are three numbers consisting of the given digits and since there are four such triples, this gives 4 ⋅ 3 = 1 2 numbers.
Now for the cases where 0 is included in the triple, it is slightly different since a three-digit number does not start with 0 and thus we get numbers of the form a b 0 or a 0 b . This gives 4 numbers for each triple where the three digits are different (so 4 ⋅ 4 = 1 6 in total) and 2 numbers for the triple ( 0 , 5 , 5 ) .
All in all, the total number of options thus is 2 4 + 1 2 + 1 6 + 2 = 5 4 .
Python Rocks :D
>>> for n in range(100,999):
...............if n%10 + (n/10)%10 + (n/100)%10 == 10:
.......................count = count + 1
>>>print count
54
if you want to loop over all 3-digit numbers, it should be range(100, 1000)
We need to count all numbers of the form a b c where:
(i) b and c are between 0 and 9 inclusive,
(ii) 1 ≤ a ≤ 9 , and
(iii) a + b + c = 1 0 .
First we'll count all such numbers that do not have 0 as one the digits. This will be the same as determining the number of solutions to the equation a + b + c = 1 0 where each of a , b and c are between 1 and 9 inclusive. This is a 'stars and bars' calculation with solution ( 2 9 ) = 3 6 .
(Check out Theorem 1 in this link for an explanation of this calculation: link )
Next, we need to count those numbers that contain 0 as one of the digits. (Note that we can't have two digits that are 0 , since then the maximum sum of the digits would then only be 9 ). Since 0 can't be the first digit, we must either have 0 as the second digit or 0 as the third digit, (and not both at the same time). Thus we need to find the number of solutions to each of the equations (i) a + c = 1 0 , and (ii) a + b = 1 0 , where in each case a , b and c are between 1 and 9 inclusive. Again using the 'stars and bars' approach, the number of solutions in each of these cases is ( 1 9 ) = 9 .
Thus the total number of three digits numbers whose digits sum to 1 0 is 3 6 + 9 + 9 = 5 4 .
Exact same approach, except for the second part. I just said for a number ABC involving one 0, there are 9 options for the first digit A , then two for the second B (being 0 or 10-A). The third digit C will be the one that wasn't used for B. Thus, 9 2 1=18.
10+9+8+7+...+2 = 55 - 1 = 54
Sum equals to 10 :
100 to 200 => {109,118,127,136,145,154,163,172,181,190}=>10
200 to 300 => {208,217,26,235,244,253,262,271,280} =>9
.
.
.
900 to 999 =>{901,910}=>2
Sum=>10+9+8+7+6+5+4+3+2=54
Distribute 10 stars among three places (the digits): C 1 0 3 = ( 1 0 1 2 ) = 6 6 . First digit cannot be 0, so take away distributions of 10 stars among two places C 1 0 2 = ( 1 1 1 ) = 1 1 . There's one last impossible number: one starting with 10 for first digit. There is 6 6 − 1 1 − 1 = 5 4
It's possible to get 5 5 = 6 6 − 1 1 with C 9 3 = ( 9 1 1 ) = 5 5 : put one star in the first digit place to avoid 0, then place 9 other stars.
o _ _ _ _ _ _ _ _ _ _ _ One stone at front because a three-digit cannot start with "zero hundred". Followed by 11 places: 9 for stars and 2 for bars. 11C2=55. However, we can't place both the bars at the last 2 place, otherwise it would be "10"00, which is 4 digits. So 55-1=54
Brute force, in Python:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
Alternatively, using the sympy library to solve the Diophantine equation a+b+c=10:
1 2 3 4 5 6 7 8 9 |
|
Now let t range through the values from 1 through 9 to obtain a, c from 0 through 9, and calculate b using the middle expression (counting the number of times the three add to 10 as a check).
Problem Loading...
Note Loading...
Set Loading...
First, let's count all numbers such that x + y + z = 1 0 :
The number of solutions of this problems is: ( 2 1 2 ) = 6 6 .
Now we take out the following solutions:
i) The ones which contain 10:
( 1 0 , 0 , 0 ) , ( 0 , 1 0 , 0 ) , ( 0 , 0 , 1 0 ) : 3 solutions.
ii) The ones which begin with 0:
( 0 , 1 , 9 ) , ( 0 , 2 , 8 ) , . . . , ( 0 , 9 , 1 ) : 9 solutions.
The number of solutions is then: 6 6 − 3 − 9 = 5 4 .