Painful list

How many (positive) integers have distinct digits and sum of digits equal to 9?


The answer is 98.

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.

6 solutions

Peter Bishop
Nov 11, 2013

integers with one non-zero digit.

09,90 -- 2!

integers with two non-zero digits.

018,081,108,801,810 ---3!

027,...,....,....,.....,......,.----3!

036.............................---3!

045..............................----3!

Sum=4*3!

integers with 3 non-zero digits.

0126,..............................----4!

0135,.................................-----4!

0234,.................................-----4!

sum= 3 * 4!

No integers with 4 non-zero digits because 1+2+3+4>9

Ans 2!+4 3!+3 4!=98

btw: each time i do i get different answers(first 18, then 32, then 86, then this, such a painful list)

i feel cheated from the fact that zeros can be added to this... XD

Zachary Sebastian - 7 years, 7 months ago

Log in to reply

yes, the right answer was 74.

Angel Leon - 7 years, 6 months ago

When making assumptions, always consider if they are valid, or if they are not necessarily true.

Calvin Lin Staff - 7 years, 7 months ago

Log in to reply

Why are we considering 0's in the digits in 09 and 90

Pranjal Rajawat - 7 years, 6 months ago

It has asked for integers with distincts digits. If you agree with, for example: 018,081,108,801 and 810. There are only 3 digits, and so, only one set which sum is 9. Well, I interpreted otherwise.

Vitor Classmann - 7 years, 7 months ago

Log in to reply

The integers are 18, 81 and 810, so there are 3 of them. The question was not asking about "sets of digits".

Calvin Lin Staff - 7 years, 7 months ago

This is a really good problem.

Rohit Kanrar - 7 years, 6 months ago

Very nice Peter! :)

Pranav Arora - 7 years, 6 months ago

The question should have mentioned about the zeros

Pranjal Rajawat - 7 years, 6 months ago

Not fair ,,,this is cheating the question should be correct and the correct answer is infinite.

AMARJEET SINGH - 7 years, 7 months ago

Log in to reply

Can you explain why you think the answer should be infinite?

Lino Demasi - 7 years, 7 months ago

i cant be infinite.because it is +ve integer and the digits are distinct.the number can't go after 4 digit.

Sreehari Vp - 7 years, 7 months ago

The answer cannot be infinte because it is asking for distinct integers.But yes,zero at the start is really a cheating

Fahad Zulfiqar - 7 years, 6 months ago

dude...i thought that too at first...and then i read the question carefully and it said that the sum should be equal to 9.....so the numbers cannot be greater than any four digit non-zero number....

Rohan Yadav - 7 years, 6 months ago
Trevor B.
Nov 10, 2013

If you write out the different possibilities for how this can be achieved with distinct nonzero digits, you will find that there are 27 27 ways to do it, put into three sets: 1 1 with 1 1 digit, 8 8 with 2 2 digits, and 18 18 with 3 3 digits. All other possible numbers that fit the problem's conditions have exactly one 0 0 somewhere in them, which does not add to the sum of the digits.

For a number with n n digits, there are n n ways to add a 0 0 into the number and create a new number. Counting the number with no 0 0 's in it, there are n + 1 n+1 numbers that can be created for each grouping of digits (for example, the group 54 54 can produce 54 54 , 540 540 , and 504 504 ).

To find the answer, multiply the number of digits in each set plus 1 1 by the number of elements in that set. 2 × 1 + 3 × 8 + 4 × 18 = 2 + 24 + 72 = 98 2\times1+3\times8+4\times18=2+24+72=\boxed{98}

Note: \textit{Note:} Another way to look at this is that you can add the extra 0 0 at the front of the number, which retains the original number. This would be saying that the possible numbers created from 54 54 are 054 = 54 054=54 , 504 504 , and 540 540 .

why we have not counted the negative integers

akhilesh agrawal - 7 years, 7 months ago

I have a question: The question asks for integers, which includes negative integers, am I right? Then the answer might not be 98, it might be 196, isn't it?

Siao Chi Mok - 7 years, 7 months ago

Log in to reply

Ques says how many +ve inteegers are there

Niraj Joshi - 7 years, 7 months ago

Log in to reply

I requested a clarification and they added the word positive in.

Trevor B. - 7 years, 7 months ago
Timothy Zhou
Nov 12, 2013

This seems like a hassle, but I simply listed the possible combinations of digits starting with the largest number in the combination. They are: (9, 0) (8, 1, 0) (7, 2, 0) (6, 3, 0) (6, 1, 2, 0) (5, 4, 0) (5, 3, 1, 0) (4, 3, 2, 0)

Now it remains to find the number of ways to order the numbers (a 0 in front means it doesn't show up in the number) for each possibility and add them up - with factorials. 2+6+6+6+24+6+24+24= 98

*To be clear: by ordering, I mean picking an order for the DIGITS to appear in the actual number

Timothy Zhou - 7 years, 7 months ago
Liu Tianyi
Feb 22, 2014

9=9 (tier 1) =1+8=2+7=3+6=4+5 (tier 2) =1+2+6=1+3+5=2+3+4 (tier 3) 1 digit numbers: 1 2 digit numbers: (2!)(4)+(1/2)(2!)(1)=9 (arrangements of tier 2 + arrangements of tier 1+0) 3 digit numbers: (3!)(2/3)(4)+(3!)(3)=34 (arrangements of tier 2+0 + arrangements of tier 3) 4 digit numbers: (4!)(3/4)(3)=54 (arrangements of tier 3+0) There cannot be a 5 digit number since 0+1+2+3+4=10>9 Hence total is 98

Happy Melodies
Nov 17, 2013

Honestly when I first saw this question, I thought of using the Stars and Bars technique. However, it doesn't work on this question because of the requirement of having distinct digits. Note that in my following attempt to explain my solution to the question, the words in [ ] are my additional comments.

First, let's go through and narrow down some of the requirements of the question. The question wants us to find how many positive integers with distinct digits that add up to 9 9 . Note that negative digits are eliminated here. Also, notice that using non-zero digits, at most 3 distinct digits can create a sum of 9 9 . Any more than 3 3 distinct non-zero digits add together will create a sum more than 9 9 , i.e. 1 + 2 + 3 + 4 > 9 1+2+3+4 > 9 . Hence, we only have to consider integers with 3 3 or less non-zero digits. [Here, I use non-zero integers to simplify the calculation of the problem as you will see below :) ].

Second, I tried to represent the question in a simpler mathematical model. Here, I realised that we can represent the condition of having distinct digits as having each digit greater than the others, i.e. In a 3 3 digit non-zero number a b c , a > b > c > 0 \overline{abc}, a>b>c>0 . From there, the idea now is to simplify this question even more, and to do so, I attempted to convert the > 0 >0 requirement into 0 \geq 0 . Notice that if you minus 1 1 from a a , minus 2 2 from b b , and minus 3 3 from c c in the previous example of a b c , a > b > c > 0 \overline{abc}, a>b>c>0 , we will get a 3 , b 2 , c 1 0 a-3, b-2, c-1 \geq 0 where a 3 + b 2 + c 1 = 9 6 = 3 a-3 + b-2 + c-1 = 9-6 = 3 . From here, by finding the number of ways of unordered a , b , c a,b,c that satisfies the condition, then permutate the digits (since the digits can be in any order, e.g. b a c \overline{bac} ), we can obtain the number of non-zero 3 3 digit number. [This is just an example of the method that I tried to solve the question: the following will have the explicit cases I have used].

Thirdly, we can observe that integers that satisfy the conditions have either 4 4 digits ( 1 1 of which is 0 0 ), 3 3 digits, 2 2 digits or 1 1 digit. Here we split the question into 3 3 (quite weirdly split cases as we are using non-zero digits in our calculation) cases:

Case 1 Integers (positive) with 3 3 non-zero digits can be either 4 4 digits ( 1 1 of which is 0 0 ) or 3 3 digits with all digits being non-zero. This can be shown as (mentioned earlier): a 3 , b 2 , c 1 0 a-3, b-2, c-1 \geq 0 and a 3 + b 2 + c 1 = 9 6 = 3 a-3 + b-2 + c-1 = 9-6 = 3

See that there are 3 unordered sets of ( ( a 3 , b 2 , c 1 (a-3, b-2, c-1 ) that satisfy the above, namely ( 3 , 0 , 0 ) , ( 2 , 1 , 0 ) , ( 1 , 1 , 1 ) (3,0,0), (2,1,0), (1,1,1) . Note that here, a 3 , b 2 , c 1 a-3, b-2, c-1 are not necessarily distinct since after adding back the 1 , 2 1,2 and 3 3 , they will definitely become distinct. Then, by allowing 0642 = 642 0642 = 642 , note that adding a zero in now to form 4 4 digit numbers ( 1 1 of which is 0 0 )or 3 3 digits with all digits being non-zero is just multiplying the 3 3 possible unordered sets by 4 ! 4! [permutating of the 4 digits including 1 0 0 ]. Hence, 3 × 4 ! = 72 3 \times 4! = 72

Case 2 Integers with 3 3 digits ( 1 1 of which is 0 0 ) or 2 2 digits with all digits being non-zero.

Similarly, we can represent this as a 2 , b 1 0 , a 2 + b 1 = 6 a-2,b-1 \geq 0, a-2 +b-1 = 6 .

Noting that there are 4 4 unordered ( a 2 , b 1 ) (a-2,b-1) that satisfy the above, number of solutions to case 2 is 4 × 3 ! = 24 4 \times 3! = 24 .

Case 3 Integers with 2 2 digits ( 1 1 of which is 0 0 ) or 1 1 digit with all digits being non-zero.

We can represent this as b 1 0 , b 1 = 8 b-1 \geq 0, b-1 = 8 .

There is only 1 unordered b 1 b-1 that satisfies the above. Hence the number of solutions to Case 3 is 1 × 2 ! = 2 1 \times 2! = 2 .

The Last Step We arrived at the answer by simply summing up the number of solutions to the 3 cases:

72 + 24 + 1 = 98 72 + 24 + 1 = \boxed{98}

P.S. Sorry for this looongg solution. I tried to include some thought processes in my solution.

Brent Jensen
Nov 16, 2013

assume set of integers from 0 to 9.

There are 3 ways to grab a set of 4 integers from above that add up to 9: 0126, 0135, and 0234.

Each of these can be permuted 24 ways for a total of 72. We will count 0126 as a 4 digit number even though it is usually represented as the 3 digit number 126.

To that sum of 72, we need to add the permutations of the missing 3 digit numbers that add to 9: 018, 027, 036, and 045.

These permute 6 ways each, for a new grand total of 96. We do NOT need to add the 3 digit sets of 126, 135, and 234 as those are already coverd in the 4 digit set.

Lastly, we need to add the 2 digit set: 09, which permutes 2 ways for a final sum of 98.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...