How many $10$ digit number exists that sum of their digits is equal to $15$?
Additional info: First digit from left is not $0$.we could use any digits from $0$ to $9$.
I saw in some related questions that they used Inclusion-exclusion .I've yet to study it so I would like someone continue one of this approaches in a way that does not need Inclusion-exclusion.However,if it's not possible without Inclusion-exclusion,write your answers anyway.
Thing I have done so far:The main challenge in this problem is counting bad situations. Because we know number of ways that sum of $10$ number is equal to $15$.
I have two approachs:
Approach #1:$$x_1+x_2+\cdots+x_{10}=15\space, \space x_1\geq 1\space ,\space 0\leq x_i\leq9$$
Using stars and bars number of answers of this equation:$$x_1+x_2+\cdots+x_{10}=15\space, \space 0\leq x_i\leq15$$
Is equal to :$${15+10-1 \choose 10-1}={24 \choose 9}$$
Now counting situations that one of $x_i$ is bigger than $10$:$$x'_1=x_1-10 \space, \space x'_2=x_2\space,\cdots,x'_{10}=x_{10}\space, \space x'_{1}+\cdots+x'_{10}=5\space,\space0\leq x'_i\leq5$$
I assume here that $x_1$ is bigger than $10$ but any of $x_i$ could be.So number of situations that one of them is bigger than $10$ is : ${5+10-1 \choose 10-1}\times10={14 \choose 9}\times 10$
Now I don't now what about situations where $x_1= 0$
Approach #2(I like this more):
I was thinking that getting rid of those situations that $x_1 = 0\space$ is much easier.So $$x_1+x_2+\cdots+x_{10}=15\space, \space x_1\geq 1\space ,\space x_2,x_3,\cdots,x_{10}\geq 0$$ So number of answers of this equation is ${15+10-1-1 \choose 10-1}={23 \choose 9}$
Now I should count number of ways one of digits is bigger than 10.I don't know what to do here.
Some updates on approach #2:
if biggest $x_i$ is $15$ , then there is $1$ possible situation with $x_1 \geq 1$.
if biggest $x_i$ is $14$ , then there is $9+9=18$ possible situation with $x_1 \geq 1$.
So my question right now is something like this:
a clever way to count situations where $x_1\geq 1$ and largest $x_i$ is equal to $10$.
Here is a c++ code that counts all these numbers.
#include <iostream>
using namespace std;
bool a(int n)
{
int i;
int sum=0;
while(n != 0)
{
i= n % 10;
sum= sum + i;
n= n /10;
}
if (sum == 15) return true;
return false;
}
int main()
{
int k=0;
for(int j=1000000000;j<9600000000;j++)
{
if(a(j))
{
k++;
}
}
cout<<k+1<<endl;
}
Which prints $808753$.
And ${23 \choose 9}-(18+1)=817171$.
So $817171 -808753 = 8418$
if biggest $x_i$ is $13$ , then there is $18+{9 \choose 2}\times 3=126$ possible situation with $x_1 \geq 1$.
So $8418 -126 =8292$.
if biggest $x_i$ is $12$ , then there is $18+6{9 \choose 2}+4{9 \choose 3}=570$ possible situation with $x_1 \geq 1$.
So $8292 - 570=7722$