Digit Sum 7

How many positive integers less than 1000000 have the sum of their digits equal to 7?

Details and assumptions

The digit sum of a number is the sum of all its digits. For example the digit sum of 1123 is 1 + 1 + 2 + 3 = 7 1 + 1 + 2 + 3 = 7 .


The answer is 792.

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.

22 solutions

Trevor B.
Nov 10, 2013

This problem is equivalent to finding the number of ways you can drop 7 7 balls into 6 6 urns. The 7 7 balls represent the sum of the digits, and the 6 6 urns represent the number of available place value spots.

The number of ways to drop n n balls into k k urns is ( k + n 1 n ) \dbinom{k+n-1}{n} . Setting k = 6 k=6 and n = 7 n=7 , there are ( 12 7 ) \dbinom{12}{7} integers < 1000000 <1000000 with the sum of their digits equalling 7 7 .

( 12 7 ) = 12 ! 7 ! 5 ! = 12 × 11 × 10 × 9 × 8 5 × 4 × 3 × 2 = 11 × 9 × 8 = 792 \dbinom{12}{7}=\dfrac{12!}{7!5!}=\dfrac{12\times11\times10\times9\times8}{5\times4\times3\times2}=11\times9\times8=\boxed{792}

This technique is also called "stars-and-bars".

As a side note, this is a stars and bars problem only because the sum of digits is less than 9. Where/How do you implicitly use this?

If the question asked for the number of positive integers less than 1000000 which have sum of digits equal to 21, what would your answer be?

Calvin Lin Staff - 7 years, 7 months ago

Log in to reply

It's a bit laborious, but we can find the total number of all solutions to a 1 + a 2 + . . . + a 6 = 21 a_1+a_2+...+a_6=21 , and then deduct the number of solutions when a i > = 10 a_i >=10 .

When a i > = 10 a_i>=10 , we can have at most 2 2 a i a_i 's greater than 10 10 .

Case 1 : When there are two of them greater than equal to 10 10

The two a i a_i 's can be chosen in ( 6 2 ) = 15 \binom{6}{2}=15 ways. Let those two elements be for instance say ( a 1 , a 2 ) (a_1,a_2) . We let a 1 = a 1 + 10 , a 2 = a 2 + 10 a_1=a'_1+10, a_2=a'_2+10 .

So we need the number of non negative solutions for a 1 + a 2 + a 3 + a 4 + . . + a 6 = 1 a'_1+a'_2+a_3+a_4+..+a_6=1 . This is : ( 6 + 1 1 1 ) = 6 \binom{6+1-1}{1}=6

Total number of such solutions = 6 15 =6 \cdot 15 .

Case 2: When only one of them is greater than equal to 10 10 .

( 6 1 ) = 6 \binom{6}{1}=6 way to choose an a i a_i .

Let, for instance, a 1 = a 1 + 10 a_1=a'_1+10

The number of solutions to a 1 + a 2 + a 3 + . . . + a 6 = 11 a'_1+a_2+a_3+...+a_6=11 is given by:

( 16 11 ) = 4368 \binom{16}{11}=4368 The required number of solutions = ( 21 + 6 1 21 ) 90 4368 = 65780 90 6 4368 = 39482 =\binom{21+6-1}{21}-90-4368=65780-90-6\cdot4368=39482 .

Note: Whenever I say "solutions" I mean non-negative(integer) solutions.

EDIT: The second case double counts the cases in case 1. This is because in Case 2, we will also have two a i a_i 's to be greater than equal to 10 10 . Once it will happen when we choose a i a_i to be 10 \geq 10 , and this a i a_i , when some other a i a_i is 10 \geq 10 , can also be 10 \geq 10 . Number of solutions are:

65780 ( 6 4368 90 ) = 39662 65780-(6\cdot4368-90)=39662 .

Aditya Parson - 7 years, 6 months ago

Log in to reply

your case 2 overlaps some solutions with case 1.. one in which 2 numbers have value >=10 You need to substract those cases which comes out to be equal to 6C1 * 5C1 * 6

YASH DALMIA - 7 years, 6 months ago

Log in to reply

@Yash Dalmia Yeah, missed that. As a matter of fact, first case is not to be considered at all. They are all counted in the second case.

Aditya Parson - 7 years, 6 months ago

Log in to reply

@Aditya Parson There is some problem in this. In the second case, the particular cases where two numbers have >10 value will be counted twice. (Think about it). How to do correct for that error?

YASH DALMIA - 7 years, 6 months ago

Log in to reply

@Yash Dalmia Ohh, I got the solution now. Case 2 minus Case 1 (as in your solution) will give us the number of cases to be substracted from the total number of cases. (since the case 2 counts the cases in 1 twice )

YASH DALMIA - 7 years, 6 months ago

Log in to reply

@Yash Dalmia Yeah, that's correct. I wrote a python program to cross check, got the same answer.

Aditya Parson - 7 years, 6 months ago

good question.. I also have this doubt. anyone with the answer??

YASH DALMIA - 7 years, 6 months ago

How do you get the formula for n balls into k urns?

A Former Brilliant Member - 7 years, 6 months ago
Dragon Curse
May 20, 2014

Note that every positive integers less than 1000000 can be written as 1 0 5 x 1 + 1 0 4 x 2 + 1 0 3 x 3 + 1 0 2 x 4 + 10 x 5 + x 6 10^5x_1+10^4x_2+10^3x_3+10^2x_4+10x_5+x_6 , where x 1 , x 2 , x 3 , x 4 , x 5 , x 6 { 0 , 1 , 2 , , 9 } x_1,x_2,x_3,x_4,x_5,x_6\in \{0,1,2,\ldots,9\} . So the answer is equal to the number of non-negatif integer solutions of the equation x 1 + x 2 + x 3 + x 4 + x 5 + x 6 = 7 x_1+x_2+x_3+x_4+x_5+x_6=7 . That is ( 12 7 ) = 792 {12\choose 7}=792 .

All other solutions split this problem into many tedious cases.

This solution needs a further step of explaining why the given condition that x i 9 x_i \leq 9 can be ignored, and this is because the condition is true since the digit sum is 7, so any digit is at most 7.

Calvin Lin Staff - 7 years ago
David Wu
Nov 10, 2013

While you might be tempted to do casework on the number of digits, there's a clever way to simplify the problem.

Instead, modify the rules a little so that leading zeros still count towards the digit count (i.e., 000001 000001 is a 6 digit integer, not a 1 digit integer). Then, we are just looking to find the number of ways to have ordered 6-tuples of nonnegative integers add up to 7.

We will use a method called stars and bars, balls and urns, sticks and stones. Imagine that 7 is represented as 7 dots, and that we have 6 distinct boxes (5 dividers). We just have to find the number of ways to rearrange the 5 dividers in 12 spots, which is ( 7 + 5 5 ) = 792 \dbinom{7+5}{5} = \boxed{792} .

Very nice, young man.

lul xd

William Cui - 7 years, 6 months ago
Bob Krueger
May 20, 2014

This problem mainly requires careful counting:

Let's construct first some six or less digit numbers whose digit sum is seven. First, notice, for example, that 7 = 1 + 2 + 4 7=1+2+4 . Using this decomposition, we can create several numbers, not just 124 or 412, but we can add zeros to the number because it won't change the digit sum. So we can make 10024, or 4012. To total up the number or numbers we can make using this specific decomposition, we can use the multinomial coeffecient, or a simpler version as follows: We have six spaces, and we want to fill them up with a 1, 2, 4, 0, 0, and 0. We can place the zeros as the leading digits because the number can be shorter than six digits. So we have no restrictions on placing the numbers. From the multinomial theorem, one can easily find that the number of numbers we can create is 6 ! 1 ! 1 ! 1 ! 3 ! = 120 \frac{6!}{1!1!1!3!}=120 . The layman, however, could see that we have six places to put the 1, then five to put the 2, then four to put the 4, and then the rest of the places can be zero. Multiplying those up we get 6 5 4 = 120 6\cdot 5 \cdot 4=120 .

However, one has to be careful when counting the layman's way. Say we use the decomposition 7 = 1 + 1 + 1 + 1 + 3 7=1+1+1+1+3 . Then we have six places to put the 3, five to put the first 1, four for the second 1, and so on until one spot is left for the zero. This is not the answer however, because we could swap any of the 1's and still have the same numbers. So a better way to think about it, more like the multinomial coeffecient, is that we have six places for the 3, and we can choose four of the remaining five places for the 1's. This gives us 6 ( 5 4 ) = 30 6\cdot \binom{5}{4}=30 , the right answer.

You can do this for all the various decompositions of 7, which I will list in case you missed any: 7 = 7 = 6 + 1 = 5 + 2 = 4 + 3 = 5 + 1 + 1 = 4 + 2 + 1 = 3 + 3 + 1 = 3 + 2 + 2 = 4 + 1 + 1 + 1 = 3 + 2 + 1 + 1 = 2 + 2 + 2 + 1 = 3 + 1 + 1 + 1 + 1 = 2 + 2 + 1 + 1 + 1 = 2 + 1 + 1 + 1 + 1 + 1 7=7=6+1=5+2=4+3=5+1+1=4+2+1=3+3+1=3+2+2=4+1+1+1=3+2+1+1=2+2+2+1=3+1+1+1+1=2+2+1+1+1=2+1+1+1+1+1 . Applying the methods detailed above and summing over all decompositions gives you a final answer of 792.

Qizhen Lim
May 20, 2014

The largest number with its digit sum equals to 7 is 610,000. Hence, we only need to consider numbers with 6 digits or less. For the sum to be equal to 7, we can distribute 7 ones among the 6 places. However, in this case we allow the space to be equal to zero. Hence, this is similar to distributing the 7 identical ones into 6 distinct places, where the place can have no 'one' at all. Hence, the number of numbers with digit sum equal to 7 is (7+6-1)C(6-1)=792.

Michael Tong
May 20, 2014

This problem can be simplified into this statement: Given all of the distinct sets of six not necessarily distinct integer elements whose sum is seven, how many permutations are there of each set? So, the first step is to find all such sets. These are:

{7, 0, 0, 0, 0, 0}

{1, 6, 0, 0, 0, 0}

{2, 5, 0, 0, 0, 0}

{3, 4, 0, 0, 0, 0}

{1, 1, 5, 0, 0, 0}

{3, 3, 1, 0, 0, 0}

{2, 2, 3, 0, 0, 0}

{1, 2, 4, 0, 0, 0}

{1, 1, 1, 4, 0, 0}

(2, 2, 2, 1, 0, 0}

{1, 1, 2, 3, 0, 0}

{1, 1, 1, 1, 3, 0}

{1, 1, 1, 2, 2, 0}

{1, 1, 1, 1, 1, 2}

Next, all we have to do is calculate. For the first set there are 6 ! 5 ! \frac {6!}{5!} permutations, so 6. For the next three sets there are \frac {6!}{4!} permutations each, resulting in a total of 90. For the next three sets there are \frac {6!}{3!2!} permutations each, giving us 180 more. For the next set there are \frac {6!}{3!} permutations, giving us another 120. For the next two sets there are \frac {6!}{3!2!} permutations each, giving us 120. For the next set there are \frac {6!}{2!2!} permutations, or 180. For the next set there are \frac {6!}{4!} permutations, or 30. For the next set there are \frac {6!}{3!2!} permutations, or 60. And finally, for the last set there are \frac {6!}{5!} permutations, or 6.

Adding these all together, we come to our final answer, 792.

(I could have grouped the subsets a bit more, but I wanted to go through a logical order of of most 0's to least 0's)

Aaron Schark
May 20, 2014

We must examine 6 separate cases depending on how many digits the number is:

1-digit - There is only 1.

2-digit - There are 7 (16, 25, 34...70)

3-digit - I looked at the starting digit

1 - There are 7 (106, 115...160)

2 - There are 6 (205, 214...250)

3 - There are 5

4 - There are 4

5 - There are 3

6 - There are 2

7 - There is only 1 (700)

Giving a total of 7+6+5+4+3+2+1=28.

4-digit - I now looked at the starting 2 digits

10 - yields 7, but I noticed that starting with 11 would yield 6, 12 would yield 5, etc. giving me a total of 28, the same as the 3-digit result

20 - yields 6, so it's identical to the above result but starting with 6 giving a result of 6+5+4+3+2+1=21

Each successive number will start with 1 less than the previous, so 30 will result in 5+4+3+2+1=15, 40 will result in 10, 50 yields 6, 60 yields 3 and 70 yields only 1 giving a grand total of 28+21+15+10+6+3+1=84 4-digit numbers.

5-digit - I began the same as the 4-digit case but started to notice the recursive pattern. I started with the first 3 digits:

100 yields 7, 101 yields 6, etc. giving a total of 28

110 yields 6, 111 yields 5, etc. giving a total of 21

120 yields 5, 121 yields 4, etc. giving a total of 15

At this point, I noticed the pattern was the same as the 4-digit number sequence and would give me a total of 84.

200 yields 6, which would start the totals with 21 then 15, etc. giving a total of 21+15+10+6+3+1=56.

Again, we are repeating the previous pattern but starting with a progressively lower number, so 300 yields 15+10+6+3+1=35, 400 yields 10+6+3+1=20, etc.

The grand total of 5-digit numbers is 84+56+35+20+10+4+1=210

6-digit - I now started with the first 4 digits

1000 yields 84+56+35+20+10+4+1=210, the same as the 5-digit result

2000 yields 56+35+20+10+4+1=126

3000 yields 35+20+10+4+1=70

etc. giving a total of 210+126+70+35+15+5+1=462 6-digit numbers.

I then found the grand total, 1+7+28+84+210+462=792

The answer is 792.

Aditya Parson
Nov 11, 2013

Every number less than 1 0 6 10^{6} can be written as : 1 0 5 a 1 + 1 0 4 a 2 + 1 0 3 a 3 + 1 0 2 a 4 + 1 0 1 a 5 + a 6 10^{5}a_1+10^{4}a_2+10^3a_3+10^2a_4+10^1a_5+a_6 where 0 a i 9 0 \leq a_i \leq 9 .

Thus, we need to find the number of non-negative integer solutions to a 1 + a 2 + . . . + a 6 = 7 a_1+a_2+...+a_6=7

The starts and bars formula for finding all ordered pairs of non-negative integers a i a_i ( 6 6 of them) , that sum to 7 7 is given by : ( 6 + 7 1 7 ) = ( 12 7 ) = 792 \binom{6+7-1}{7}=\binom{12}{7}=792

Here is a way to solve this in python: Set count = 0

    for i in list(range(0,1000000)):

         sum = 0

         for x in list(range(len(str(i)))):

              sum = sum + int(str(i)[x])

         if sum == 7:

              count = count + 1

Now print the count.

Gino Pagano - 7 years, 7 months ago

Log in to reply

Yeah... And the math? Every problem in this topic can be solved by a computer by brute force, but... well, that is not the idea of Brilliant.

Sebastian Puerto - 7 years, 7 months ago

First time we see this kind of problem, we can count it by digits possibilities (e.g. 1 digit, 2 digits, ...) as a promising way, but it waste minutes. So, how can we fasten it? The method i'd like to use is to count how many non-negative integers fulfilling

x 1 + x 2 + x 3 + x 4 + x 5 + x 6 = 7 {x_1+x_2+x_3+x_4+x_5+x_6=7}

as the numbers can't be all 0.

We need to know that positive integers less than 1000000 has at most 6 digits, hence we get 6 numbers to be added later. The sum of those numbers is 7. So, we need to find how many ordered pairs are there.

It's the same as we count (7+6-1)C(7) = 792 \boxed{792} .

Lee Gao
Nov 11, 2013

This is equivalent to the problem of counting the total number of 6 digit integers that allow zeros at the beginning and whose digits sum up to 7.

Let's consider the general problem of counting the total number of k k digit integers whose digits sums up to n n . We'll introduce a decision variable called a k n a_{kn} to denote precisely this value. Now, suppose we're looking for a 3 digit number whose digits sum up to 3. Well, we can start with 3 blank cells $$ \boxed{~} \boxed{~} \boxed{~} $$ In the leftmost box, we can either put in a 0 , 1 , 2 , 0, 1, 2, or a 3 3 . Suppose we put a 1 1 there, then we now have the configuration $$ \boxed{1} \boxed{~} \boxed{~} $$ in order for all the digits to sum up to 3, it better be the case that the remaining unfilled boxes add up to 2. But without loss of generality, this becomes the problem of finding how many 2-digit numbers there are whose digits sum up to 3-1, or a 22 a_{22} . Likewise, if we had filled a 2 2 in the leftmost box, like $$ \boxed{2} \boxed{~}\boxed{~} $$ then we need to find the number of 2-digit numbers whose digits sum up to 3 2 = 1 3-2 = 1 , which is denoted a 21 a_{21} . In fact, we could sub in any number less than or equal to n n into that first slot, so we get the equation $$ a {33} = a {20} + a {21} + a {22} + a_{23} $$

Furthermore, as long as the sum of the digits is less than 10, we also know that a 1 n = 1 a_{1n} = 1 , so this gives us the recurrence $$ \begin{array}{rl} a {1n} &= 1 \\ a {kn} &= \sum {j=0}^n a {k-1,j} \ \end{array} $$ Let's take this for a spin to see if we can see any patterns. $$ \begin{array}{rl} a {20} &= a {10} = 1 \\ a {21} &= a {10} + a {11} = 2 \\ a {22} &= a {10} + a {11} + a {12} = 3 \\ a {2n} &= n + 1 \\ a {3n} &= \sum {j=0}^n a {2j} \\ &= \sum {j=0}^n (j+1) \\ &= {n+2 \choose 2} \\ a {4n} &= \sum {j=0}^n a {3j} \\ &= \sum {j=0}^n {n+2 \choose 2} \\ &= {n+3 \choose 3} \\ a_{kn} &= {n+k-1 \choose k-1} \end{array} $$ So to answer the question, just find a 67 = ( 12 5 ) = 792 a_{67} = {12 \choose 5} = 792

Note: this is combinatorially equivalent to the integer partition problem as well as the balls-and-urns problem, which admits the same relation.

Bhargav Das
Nov 11, 2013

We need to find the number of positive integers less than 1000000 1000000 whose digit sum is 7 7 .

Step 1 :We notice,all positive integers less than 1000000 1000000 have 6 digits or less.

Step 2 :Let the digits in 6th,5th,4th,3rd,2nd and unit's place be represented as x 1 , x 2 , x 3 , x 4 , x 5 , x 6 x_{1},x_{2},x_{3},x_{4},x_{5},x_{6} , where each of them may be equal to 0 0 ,but not all at once.

Step 3 :We are required to find all possible non-negative solutions of the equation: x 1 + x 2 + x 3 + x 4 + x 5 + x 6 = 7 x_{1}+x_{2}+x_{3}+x_{4}+x_{5}+x_{6}=7

Step 4 : The total no. of solutions of the equation is given by:

( 7 + 6 1 7 ) = ( 12 7 ) = 792 \dbinom{7+6-1}{7}=\dbinom{12}{7}=\boxed{792}

Note :The method used above to find the total no. of solutions is called "Stars and Bars Method".You can refer this.

Bhargav Das - 7 years, 7 months ago
Alexander Sludds
Jan 3, 2014

Note that we can apply stars and bars here. We have 7 objects (1's) to distribute. Consider 6 digit numbers. We must distribute a one into the leftmost space in order to make sure that it does not star with a zero. There must be 5 dividers between the digits. Thus, the amount of ways we can do six, five, four,...., one digit numbers is ( 11 5 ) + ( 10 4 ) + ( 9 3 ) + ( 8 2 ) + ( 7 1 ) + ( 6 0 ) {11 \choose 5}+ {10 \choose 4} + {9 \choose 3} + {8 \choose 2} + {7 \choose 1} + {6 \choose 0} = 792 =792 respectfully.

Perhaps we can simply calculate (7+6-1)C7= 792.

Michael Wood - 7 years, 4 months ago
Jackal Jim
Nov 17, 2013

When I first saw this question about digit sum, the Stars and Bars technique first came into my mind. On a side note, since the question asks for positive integers less than 1000000 1000000 , all integers must have 6 6 or less digits.


Using the Stars and Bars technique, the question translates mathematically into a + b + c + d + e + f = 7 a+b+c+d+e+f = 7 where ( a , b , c , d , e , f ) (a,b,c,d,e,f) are non-negative integers, representing the digits of the integers satisfying the conditions. Note that the solution to this question is simply the number of ordered pairs of ( a , b , c , d , e , f ) (a,b,c,d,e,f) .

Applying the Stars and Bars method, there are 5 5 bars to separate the integers into 6 6 digits, and 7 7 stars. Hence, we arrived at the answer: ( 7 + 5 5 ) = ( 12 5 ) = 792 {7+5 \choose 5} = {12 \choose 5} = \boxed {792} .

Gardar Sigurdsson
Nov 14, 2013

We can rephrase the question to being in how many ways you can choose a , b , c , d , e , f ( 0 , 1 , 2 , . . . , 6 , 7 ) a,b,c,d,e,f \in (0,1,2,...,6,7) so that a + b + c + d + e + f = 7 a+b+c+d+e+f=7 . That question can then be rephrased to in how many ways can you divide 7 crosses with 5 lines. One possible arrangement is X X X X X X X ||XX|X|XXX|X which would then represent the number 0021301. Answering the last question is easy. Imagine we have 7 + 5 = 12 7+5=12 boxes and we toss the five line so that they land randomly in the boxes, only one in each box. In the rest of the boxes we then put crosses. The lines can be randomly tossed in ( 12 5 ) = 792 {12 \choose 5} = 792 ways. Hence the answer is 792.

Andrias Meisyal
Nov 10, 2013

Solving this question, you can use the Stars and Bars (combinatorics) :

6 positions are available for the digits: * * * * * *

this can be reframed as the positive integer as well as 6-digits can not be 0. So, how many positive integer is ( n + k 1 k ) = ( n + k 1 n 1 ) \binom{n+k-1}{k} = \binom{n+k-1}{n-1}

k k is 7 7 as the sum of digits equal and n n is 6 6 the star as the partition. We can count, ( n + k 1 k ) = ( 6 + 7 1 7 ) \binom{n+k-1}{k}\ = \binom{6+7-1}{7}

( 12 7 ) = 12 ! 7 ! 5 ! \binom{12}{7} = \frac{12!}{7!5!}

792 \boxed{792} .

Anshul Ahuja
May 26, 2016

I did it using multinomial,similar to the stars and bars method Reduces to 12C5

Taehyung Kim
Nov 16, 2013

Notice that the problem is equivalent to finding a sequence of 6 digits that sum to 7 (notice that in a sequence, the first digit can be 0). So we have to find all nonnegative integer solutions to a 1 + a 2 + a 3 + a 4 + a 5 + a 6 = 7. a_1 + a_2 + a_3 + a_4 + a_5 + a_6 = 7. Now we can use distributions. If we have 7 objects and 5 dividers, scrambling it will give us 6 groups of objects. Thus, we have ( 12 5 ) = 792. \binom{12}{5} = 792.

Bodhisatwa Nandi
Nov 16, 2013

6 positions are available for the digits :- - - - - -

Then the question can be re-framed as "non-negative integers" as all 6 digits can't be 0

Now, using the stars and bars formula, Number of integers = (7+6-1)C(6-1) = 12C5 = 792

Ankit Ghosh
Nov 12, 2013

6ta digit..so a+b+c+d+e+f=7 er number of non negative solutions holo answer.

Which is 12C5=792

Can you explain your reasoning?

Lino Demasi - 7 years, 7 months ago

since 12C7 = 12C5

ankit ghosh - 7 years, 7 months ago
Vaibhav Reddy
Nov 12, 2013

We'll just assume the number to be a b c d e f abcdef just like 123456 123456 .

According to the question, a + b + c + d + e + f = 7 a+b+c+d+e+f=7

Since it can be a one-digit or two-digit number which means a , b , c , d , e , f , g , h a,b,c,d,e,f,g,h any of them can be equal to 0 0 .....

So we need to find solutions for a + b + c + d + e + f = 7 a+b+c+d+e+f=7

Formula - C ( n + r 1 , r 1 ) C(n+r-1,r-1) where n = 7 , r = 6 n=7,r=6

Hence we get the answer as 792 \boxed{792}

more words than numbers....

Vaibhav Reddy - 7 years, 7 months ago

Log in to reply

Having more words than numbers is perfectly okay in a math proof. The point of a solution is to communicate the answer to other people, as well as the way of getting the answer. Words are great for communicating to other people.

If a solution only has numbers and symbols, it's often hard to follow. Adding words makes it more readable and less dense. Just as it is possible to use too few words, it is possible to use too many words. Finding the right balance is sometimes tricky.

Lino Demasi - 7 years, 7 months ago

Log in to reply

Thank you...

Vaibhav Reddy - 7 years, 7 months ago
Rajiv Movva
Nov 11, 2013

The number of k with k Z + , k < 1000000 , S ( k ) = 7 k \text{ with } k \in \mathbb{Z}^+, k<1000000, S(k) = 7 can be found by splitting into six cases by the number of digits.

Case 1: 6 digits We are simply finding the number of solutions to x 1 + x 2 + + x 6 = 7 x_1+x_2+\cdots + x_6 = 7 , where the x i s x_i's are the digits in order. Since x 1 > 1 x_1>1 , we must subtract 1 1 from the RHS, yielding x 1 + x 2 + + x 6 = 6 x_1+x_2+\cdots + x_6 = 6 which the number of solutions to can be easily found with stars and bars . Applying the formula, we have ( n + k 1 n ) ( 6 + 6 1 6 ) = ( 11 6 ) = 462 \dbinom{n+k-1}{n} \implies \dbinom{6+6-1}{6} = \dbinom{11}{6} = 462 desired numbers.

Case 2: 5 digits Similarly, our equation is x 1 + x 2 + + x 5 = 6 x_1+x_2+\cdots + x_5 = 6 which gives d b i n o m 106 = 210 dbinom{10}{6} = 210 numbers.

We continue on with each of the cases for a final answer of ( 11 6 ) + ( 10 6 ) + ( 9 6 ) + ( 8 6 ) + ( 7 6 ) + ( 6 6 ) = 462 + 210 + 84 + 28 + 7 + 1 = 792 numbers . \dbinom{11}{6}+\dbinom{10}{6}+\dbinom96+\dbinom86+\dbinom76 + \dbinom66 = 462 + 210 + 84 + 28 + 7 + 1 = \boxed{792} \text{ numbers}.

Tanishq Aggarwal
Nov 11, 2013

I love stars and bars problems :D

Represent each "unit" we want by a star; there are 7 such stars (representing the 7 that the digits must add up to). Additionally, all of the numbers must be less than 700,000, so we put 5 bars into a mixture with 7 stars. These bars separate the 7 stars into 6 digits. There are ( 7 + 5 ) ! 7 ! 5 ! = 792 \frac{(7+5)!}{7!5!}=\boxed{792} ways to arrange this mixture of stars and bars, and in this manner we arrive at our desired integers.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...