Digital Arithmetic

How many 4-digit numbers are there such that the thousands digit is equal to the sum of the other 3 digits?


Details and Assumptions:

  • The number 12 = 012 12=012 is a 2-digit number, not a 3-digit number.


The answer is 219.

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.

16 solutions

James Lin
May 20, 2014

Let the thousands digit be k k for some 1 k 9 1\leq k\leq 9 .

Then, the sum of the other 3 3 digits are k k . By sticks and stones, we can compute the number of numbers with a thousands digt k k by dividing the k k with 2 2 dividers. Then, the number of such numbers is ( k + 2 2 ) \binom{k+2}{2} , and all such partitions are clearly valid (i.e. each digit is between 0 0 and 9 9 ).

Summing this up for all 1 k 9 1\leq k\leq 9 , we get

( 3 2 ) + ( 4 2 ) + + ( 11 2 ) \binom{3}{2}+\binom{4}{2}+\cdots +\binom{11}{2}

= ( 2 2 ) + ( 3 2 ) + ( 4 2 ) + + ( 11 2 ) ( 2 2 ) =\binom{2}{2}+\binom{3}{2}+\binom{4}{2}+\cdots +\binom{11}{2}-\binom{2}{2} .

By the hockey stick identity, this is equivalent to

( 12 3 ) 1 = 219 \binom{12}{3}-1=\boxed{219}

I'm slightly surprised that no one treated this as ( 12 3 ) 1 {12 \choose 3} - 1 directly, by solving for b + c + d + e = 9 b + c + d + e = 9 , 0 b , c , d , e 0 \leq b, c, d, e and removing the case that ( b , c , d ) = ( 0 , 0 , 0 ) (b, c, d) = (0, 0, 0) .

(Edit) From there, we can generate the 4-digit number a b c d \overline{abcd} , with a = b + c + d a = b+c+d . It remains to demonstrate that we truly have a bijection.

Calvin Lin Staff - 7 years ago

Log in to reply

I'm so dumb, I completely forgot about that...

Eric Shi - 1 year, 2 months ago

I don't understand if the correct answer is 219. it seems you disregard the details and assumptions. My answer is 165, need help I'm confused.

Gerome Tejada - 6 years, 9 months ago

Log in to reply

n = 1 9 n ( n + 1 ) / 2 \sum _{ n=1 }^{ 9 }{ \ { n(n+1) }/{ 2 } } = 165

Gerome Tejada - 6 years, 9 months ago

Log in to reply

165: 1100, 2101, 2110, 2200, 3102, 3111, 3120, 3201, 3210, 3300, 4103, 4112, 4121, 4130, 4202, 4211, 4220, 4301, 4310, 4400, 5104, 5113, 5122, 5131, 5140, 5203, 5212, 5221, 5230, 5302, 5311, 5320, 5401, 5410, 5500, 6105, 6114, 6123, 6132, 6141, 6150, 6204, 6213, 6222, 6231, 6240, 6303, 6312, 6321, 6330, 6402, 6411, 6420, 6501, 6510, 6600, 7106, 7115, 7124, 7133, 7142, 7151, 7160, 7205, 7214, 7223, 7232, 7241, 7250, 7304, 7313, 7322, 7331, 7340, 7403, 7412, 7421, 7430, 7502, 7511, 7520, 7601, 7610, 7700, 8107, 8116, 8125, 8134, 8143, 8152, 8161, 8170, 8206, 8215, 8224, 8233, 8242, 8251, 8260, 8305, 8314, 8323, 8332, 8341, 8350, 8404, 8413, 8422, 8431, 8440, 8503, 8512, 8521, 8530, 8602, 8611, 8620, 8701, 8710, 8800, 9108, 9117, 9126, 9135, 9144, 9153, 9162, 9171, 9180, 9207, 9216, 9225, 9234, 9243, 9252, 9261, 9270, 9306, 9315, 9324, 9333, 9342, 9351, 9360, 9405, 9414, 9423, 9432, 9441, 9450, 9504, 9513, 9522, 9531, 9540, 9603, 9612, 9621, 9630, 9702, 9711, 9720, 9801, 9810, 9900

Gerome Tejada - 6 years, 9 months ago

Log in to reply

@Gerome Tejada ? but it says the sum of the other 3 digits, 1001, 1010 , 2011, 2002,2020 etc. (165+2+3+4+5+6+7+8+9+10 =219) the others you forgot

Luis King - 6 years, 4 months ago

the real answer is 999

Hatem Kareem - 2 years, 5 months ago

It should be 213. Can someone please explain me, why is it so? Because I found all 213 numbers showing this property. But what are the other 6?

Askt Negi - 7 months, 4 weeks ago

@Calvin Lin How can b + c + d + e = 9 b + c + d + e = 9 if b + c + d = e 9 b+c+d = e ≤ 9 ? I'm assuming your 4-digit to be in the form b c d e bcde

Harry Lam - 5 months ago

Log in to reply

Ah, sorry for not defining terms.
The number is a b c d \overline{abcd} . In particular, e e isn't the thousands digit. e e represents the extent to which the thousands digit is less than 9, or that e = 9 a = 9 ( b + c + d ) e = 9 - a = 9 - (b + c + d) .

Does this make sense now?

(I've edited the original comment.)

Calvin Lin Staff - 5 months ago

Log in to reply

Yes, that makes more sense. Thanks

Harry Lam - 5 months ago
Shyam Arora
May 20, 2014

Let the thousands digit be N. For the sum of remaining three digits to be equal to N, we can do it in N+2 C2 ways (two will be the number of partitions between the remaining three digits). So, if N = 1, numbers that are possible = 1+2 C2 = 3 C2 = 3. If N = 2, we have 2+2 C2 = 4 C2= 6 ways. Similarly, we go on doing this till the time N = 9. Hence, the total would be 3 + 6 + 10 + 15 + 21 + 28 + 36 + 45 + 55 = 219 numbers!

Deep Chanda
May 20, 2014

Let the 4-digit number be abcd. As per the given question b+c+d=a. Now,we know that the possible values of 'a' range from 1 to 9.

Therefore the problem reduces to finding the all possible tuples such that the value of a+b+c lies in the range. So ,basically we evaluate the no of solutions to the equations a+b+c =r where 0< r <10 solution for any r is (r+2)(r+1)/2 so total no of tuples is ∑(r+2)(r+1)/2 ,where r runs from 1 to 9. the solution comes out as ∑(r+2)(r+1)/2=219

I donot understand

Omar EL-Raouf - 7 years ago

For each given thousands digit 1-9, we just use sticks and balls to divide them up into 3 numbers which can be zero. For 1, there is 1 ball and 2 sticks, so the total is 3C2=3. Similarly, for a thousands digit n the total is nC2. Then the total is 3+6+10+15+21+28+36+45+55=219.

Since 0 in the thousands digit is not considered, the possible numbers the thousands digit can have is 1,2,3,4,5,6,7,8, and 9.

Let's take a note in the number of possible combinations the 3 digits left can have.
If we have 3 distinct numbers, then the number of possible combinations is ( 3 1 ) = 6 {3 \choose 1} = 6 . If we have 2 distinct numbers we have ( 3 2 ) = 3 {3 \choose 2} = 3 and when we have only one distinct number we have ( 3 3 ) = 1 {3 \choose 3} = 1

The possible numbers that can add up to 1 is ( 0 , 0 , a n d 1 ) (0,0, and 1) . Therefore it can only have 3 numbers.
The possible numbers that can add up to 2 is ( 0 , 0 , a n d 2 ) (0,0, and 2) and ( 0 , 1 , a n d 1 ) (0,1, and 1) . Therefore it can only have a total of 6 numbers.
The possible numbers that can add up to 3 is ( 0 , 0 , a n d 3 ) (0,0, and 3) , ( 1 , 1 , a n d 1 ) (1,1, and 1) and ( 0 , 1 , a n d 2 ) (0,1, and 2) . Therefore it can only have a total of 10 numbers.
The possible numbers that can add up to 4 is ( 0 , 0 , a n d 4 ) (0,0, and 4) , ( 1 , 1 , a n d 2 ) (1,1, and 2) , ( 1 , 0 , a n d 3 ) (1,0, and 3) and ( 2 , 2 , a n d 0 ) (2,2, and 0) . Therefore it can only have a total of 15 numbers.
Working them up, until 9. You will get:
3 + 6 + 10 + 15 + 21 + 28 + 36 + 45 + 55 = 219 3+6+10+15+21+28+36+45+55 = 219




Carlo Nuñez
May 20, 2014

Let a 4-digit number be ABCD. The problem is equivalent to solving the number of integer solutions of B, C and D in the equation A = B + C + D.

Taking the case where A = 9, we have B + C + D = A. Imagine B, C, and D are jars where we put 9 sticks inside them. We have to find the number of possible arrangements of the 9 sticks and the 2 plus signs in a line. Thus, the number of 4-digit numbers 9BCD such that B + C + D = 9 is 11/(9!2!) or 11C2.

Since A ranges from 1 to 9, the number of such ABCD is the sum 11C2 + 10C2 + ... + 3C2, which is equal to 219.

Vincent Zhuang
May 20, 2014

For thousands digit n n , there are ( n + 2 2 ) \binom{n+2}{2} numbers that satisfy the required conditions (we simply consider the number of ways to place two dividers in a row of n n ones). Therefore, summing from n=1 to 9 gives 219 219 .

T Wj
May 20, 2014

this question is just about application of stars and bars. As there are 3 tuples (units digit, tens digit and hundreds digit), therefore we have 2 bars: front of the first bar will be hundreds digit, between them tens digit, and behind of the second bar will be units digit. Let the value of thousands digit be stars, and let it be k . Now we have k stars and 2 bars and the combination will be \frac {(k + 2)!}{k! * 2!} = {k+2 \choose 2}

So the number of 4-digit numbers = \displaystyle \sum_{i=1}^9 {i+2 \choose 2} = \frac { 9 * ( 9^2 + 6 * 9 + 11 )}{6} = 219

Peter Byers
May 20, 2014

Since we are excluding 0000 0000 the number of possibilities is

1 + n = 0 9 ( n + 1 ) ( 10 n ) -1+\sum_{n=0}^9 (n+1)(10-n)

= 1 + n = 0 9 ( 10 + 9 n n 2 ) =-1+ \sum_{n=0}^9 (10+9n-n^2)

= 99 + 2 n = 0 4 n ( 9 n ) =99 + 2\sum_{n=0}^4 n(9-n)

= 99 + 9 ( 20 ) 2 ( 1 + 4 + 9 + 16 ) =99+9(20)-2(1+4+9+16)

= 219 =219

(The index n n represents the sum of the last two digits. Then there are n + 1 n+1 possibilities for those two digits, and 10 n 10-n possibilities for the first two digits, excepting the adjustment for 0000 0000 .)

ABCD ==> A = (B+C+D)

For a = n ===> (n+2)C2 numbers

==> total numbers = 3C2 + 4C2 + 5C2 + 6C2 + 7C2 + 8C2 + 9C2 + 10C2 + 11C2

Michael Wood
Jan 17, 2014

Let the number be "abcd", where 1<=a<=9. Now let b+c+d=a=9-K, 0<=K<=8. This can be transformed to b+c+d+K=9, yielding (9+4-1)C9=220. However, we must minus 1 from 220 since K is not 9, thus the solution is 219.

I've solved this with the stars-and-bars formula as well with distinct term for distinct total, but can't get a hang of your composite formula. Here's how I did it:

Since 0 0 is not a 4 4 digit number, we omit the stars-and-bars term for this total. This can now be expressed as follows:

( 3 + 1 1 1 ) + ( 3 + 2 1 2 ) + ( 3 + 3 1 3 ) + ( 3 + 4 1 4 ) + ( 3 + 5 1 5 ) + ( 3 + 6 1 6 ) + ( 3 + 7 1 7 ) + ( 3 + 8 1 8 ) + ( 3 + 9 1 9 ) \binom{3+1-1}{1} + \binom{3+2-1}{2} + \binom{3+3-1}{3} + \binom{3+4-1}{4} + \binom{3+5-1}{5} + \binom{3+6-1}{6} + \binom{3+7-1}{7} + \binom{3+8-1}{8} + \binom{3+9-1}{9}

= 3 + 6 + 10 + 15 + 21 + 28 + 36 + 45 + 55 = 3 + 6 + 10 + 15 + 21 + 28 + 36 + 45 + 55

= 219 = \boxed{219}

MILIND CHANGIRE - 7 years, 3 months ago
Omar Muhammad
May 20, 2014

219: 1001, 1010, 1100, 2002, 2011, 2020, 2101, 2110, 2200, 3003, 3012, 3021, 3030, 3102, 3111, 3120, 3201, 3210, 3300, 4004, 4013, 4022, 4031, 4040, 4103, 4112, 4121, 4130, 4202, 4211, 4220, 4301, 4310, 4400, 5005, 5014, 5023, 5032, 5041, 5050, 5104, 5113, 5122, 5131, 5140, 5203, 5212, 5221, 5230, 5302, 5311, 5320, 5401, 5410, 5500, 6006, 6015, 6024, 6033, 6042, 6051, 6060, 6105, 6114, 6123, 6132, 6141, 6150, 6204, 6213, 6222, 6231, 6240, 6303, 6312, 6321, 6330, 6402, 6411, 6420, 6501, 6510, 6600, 7007, 7016, 7025, 7034, 7043, 7052, 7061, 7070, 7106, 7115, 7124, 7133, 7142, 7151, 7160, 7205, 7214, 7223, 7232, 7241, 7250, 7304, 7313, 7322, 7331, 7340, 7403, 7412, 7421, 7430, 7502, 7511, 7520, 7601, 7610, 7700, 8008, 8017, 8026, 8035, 8044, 8053, 8062, 8071, 8080, 8107, 8116, 8125, 8134, 8143, 8152, 8161, 8170, 8206, 8215, 8224, 8233, 8242, 8251, 8260, 8305, 8314, 8323, 8332, 8341, 8350, 8404, 8413, 8422, 8431, 8440, 8503, 8512, 8521, 8530, 8602, 8611, 8620, 8701, 8710, 8800, 9009, 9018, 9027, 9036, 9045, 9054, 9063, 9072, 9081, 9090, 9108, 9117, 9126, 9135, 9144, 9153, 9162, 9171, 9180, 9207, 9216, 9225, 9234, 9243, 9252, 9261, 9270, 9306, 9315, 9324, 9333, 9342, 9351, 9360, 9405, 9414, 9423, 9432, 9441, 9450, 9504, 9513, 9522, 9531, 9540, 9603, 9612, 9621, 9630, 9702, 9711, 9720, 9801, 9810, 9900

I think the correct answer is 165.... above list is wrong.

Binu Babu - 6 years, 6 months ago
Jonathan Coronado
Apr 15, 2015

The way I solved this problem is very simple. First, I started by listing the possible combinations (1010, 1001, 1100, etc.) After getting past three as the thousands digit, I looked for a pattern. I noticed that the set for 2 as the thousands digit had 3 more possibilities than the set with 1 as a thousands digit. For the set with 3 as the thousands digit, it had 4 more combinations than the set for 2. After this, I saw the pattern that for every new set, the addend for the pattern was increased by one. (+3, +4, +5, +6...) I added them and got 3+6+10+15+21+28+36+45+55=219 Thus, I had calculated the amount of combinations without having to list them all.

That's a good start! Keep at it Jonathan!

Look at the other solutions to see a more direct approach for this problem.

Calvin Lin Staff - 6 years, 1 month ago
Anu K
Feb 18, 2020

I don't know the concepts others have used although they look really cool and I would love to learn them.

I solved this by finding a pattern which I'm sure many others have written about too. With 1 in thousands place we get 3 possibilities. These 3 possibilities are similar for all digits from 1-9. Now, for the rest. With 2 in thousands place, we have 6 possibilities. With 3, we have 10 possibilities and so on.

3+6+10+.... Looks like 3+ (3+3) +(6+4)....

Following this we get,

3+6+10+15+21+28+36+45+55, which gives 219

Sheamus McGuigan
Feb 15, 2018

import java.util.ArrayList; import java.util.List;

public class FourDigitNumbers { private List<Integer> mMatches;

public FourDigitNumbers() {
    mMatches = new ArrayList<Integer>();

}

public void checkForMatches() {

    for (int i = 1; i <= 9; i++) {
        for (int d = 0; d <= 999; d++) {

            if (i == getSumOfDigits(d)) {
                mMatches.add(d + (i * 1000));
            }
        }
    }
}

public ArrayList<Integer> getMatches() {

    return mMatches;
}

public int getNumberOfMatches() {

    return mMatches.size();
}

private int getSumOfDigits(int i) {
    int digitSum = 0;

    List<Integer> digits = new ArrayList<Integer>();
    while (i > 0) {
        digits.add(i % 10);
        i /= 10;
    }

    for (int d = 0; d < digits.size(); d++) {

        digitSum += digits.get(d);

    }
    return digitSum;
}

}

Output: [1001, 1010, 1100, 2002, 2011, 2020, 2101, 2110, 2200, 3003, 3012, 3021, 3030, 3102, 3111, 3120, 3201, 3210, 3300, 4004, 4013, 4022, 4031, 4040, 4103, 4112, 4121, 4130, 4202, 4211, 4220, 4301, 4310, 4400, 5005, 5014, 5023, 5032, 5041, 5050, 5104, 5113, 5122, 5131, 5140, 5203, 5212, 5221, 5230, 5302, 5311, 5320, 5401, 5410, 5500, 6006, 6015, 6024, 6033, 6042, 6051, 6060, 6105, 6114, 6123, 6132, 6141, 6150, 6204, 6213, 6222, 6231, 6240, 6303, 6312, 6321, 6330, 6402, 6411, 6420, 6501, 6510, 6600, 7007, 7016, 7025, 7034, 7043, 7052, 7061, 7070, 7106, 7115, 7124, 7133, 7142, 7151, 7160, 7205, 7214, 7223, 7232, 7241, 7250, 7304, 7313, 7322, 7331, 7340, 7403, 7412, 7421, 7430, 7502, 7511, 7520, 7601, 7610, 7700, 8008, 8017, 8026, 8035, 8044, 8053, 8062, 8071, 8080, 8107, 8116, 8125, 8134, 8143, 8152, 8161, 8170, 8206, 8215, 8224, 8233, 8242, 8251, 8260, 8305, 8314, 8323, 8332, 8341, 8350, 8404, 8413, 8422, 8431, 8440, 8503, 8512, 8521, 8530, 8602, 8611, 8620, 8701, 8710, 8800, 9009, 9018, 9027, 9036, 9045, 9054, 9063, 9072, 9081, 9090, 9108, 9117, 9126, 9135, 9144, 9153, 9162, 9171, 9180, 9207, 9216, 9225, 9234, 9243, 9252, 9261, 9270, 9306, 9315, 9324, 9333, 9342, 9351, 9360, 9405, 9414, 9423, 9432, 9441, 9450, 9504, 9513, 9522, 9531, 9540, 9603, 9612, 9621, 9630, 9702, 9711, 9720, 9801, 9810, 9900] Solution: 219

Lol Lol
Jun 10, 2017

Just write out all the possible three digit numbers, so a list from 1 - 999, then take off all the numbers of which their digits total to over 9. For example: 901 totals to ten, so we have to take it off the list. What you are left with is all the possible combinations for this question. Count them up and hey presto!

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...