# Sum of all the positive integers with different digits till $100$

What is the sum of all the positive integers with 2 different digits till $100$ (without numbers with one digit and $100$) ?

This was a problem I thought after hearing about Gauss and the Sum of integer till $100$. Here's how I tried to solve it:

I know that the sum of all the positive integer till $100$ that's $5050$ and that's given by the formula:

$$\sum_{k=0}^n k = \frac{n(n+1)}{2}$$

So if I take the sum of all the integers and subtract the sum of all the integers with the same digits I'll get my result. So: $$5050-(11+22+33+44+55+66+77+88+99)= 5050-11(1+2+3+4+5+6+7+8+9)= 5050-11\left(\frac{9\cdot 10}{2}\right)=4555$$ Is this right? Thanks!

• You might want to exclude $100$ too, since there are two zeroes. – Daniel R May 6 '14 at 19:14
• 1-9 should probably be excluded as well. – wvdz May 6 '14 at 19:15
• It depends on what exactly you mean by saying "numbers with different digits". If those numbers $11, 22, 33, 44, 55, 66, 77, 88, 99$ are the only ones you want to exclude, then yes, the proof is flawless, but as the other comments mention, the problem could be understood in various ways. Tbh I think you should clarify the statement of your problem. – user26486 May 6 '14 at 19:21
• edited the question – Peterix May 6 '14 at 19:29

I know you had given this in your question but I am typing this again$$5050-(11+22+33+44+55+66+77+88+99)$$ $$= 5050-11(1+2+3+4+5+6+7+8+9)$$ $$= 5050-11\left(\frac{9\cdot 10}{2}\right)=4555$$
Your answer and method both are completely correct. Since you just need the numbers with $2$ different digits and $100$ has $2$ different digits i.e. $1$ and $0$. Hence you don't need to subtract $100$ also.