Probability that sum of three digits is the same as sum of other three digits How can I solve problems like this:
Let ${c_1,c_2,c_3,c_4,c_5,c_6}$ be a random sequence where $c_i\in (0,1,2,3,4,5,6,7,8,9)$ What is probability that $c_1+c_2+c_3=c_4+c_5+c_6$,
$c_1$ to $c_6$ is not a number there can be all zeroes and combination like $1,1,1$ etc. is possible.
I have a problem with getting how many is combinations there are. I saw that for a specific number like $c_1+c_2+c_3=12$, it is possible to use a generating function, but I don't know how to use it when we have statement like in this problem.
 A: It seems that you know how to compute $$p_k:=P\bigl[c_1+c_2+c_3=k\bigr]\qquad(0\leq k\leq27)\ .$$
The final result $p$ is then simply given by
$$p=\sum_{k=0}^{27}p_k^2\ .$$
By the way: The generating function for the number of choices of $c_1$, $c_2$, $c_3$ summing to a given $k$ is
$$\left(\sum_{i=0}^9 x^i\right)^3=(1-x^{10})^3(1-x)^{-3}=(1-3x^{10}+3x^{20}-x^{30}\bigr)\sum_{j=0}^\infty{2+j\choose j}x^j\ .$$
A: You are looking for
$$N_{\,b} (s,r,m) = \text{No}\text{. of solutions to}\;\left\{ \begin{gathered}
  0 \leqslant \text{integer  }x_{\,j}  \leqslant r \hfill \\
  x_{\,1}  + x_{\,2}  +  \cdots  + x_{\,m}  = s \hfill \\ 
\end{gathered}  \right.$$
which is given by
$$
N_b (s,r,m)\quad \left| {\;0 \leqslant \text{integers  }s,m,r} \right.\quad  =
\sum\limits_{\left( {0\, \leqslant } \right)\,\,k\,\,\left( { \leqslant \,\frac{s}{r+1}\, \leqslant \,m} \right)} 
{\left( { - 1} \right)^k \binom{m}{k}
 \binom
 { s + m - 1 - k\left( {r + 1} \right) } 
 { s - k\left( {r + 1} \right)}\ }
$$
as widely explained in this related post.
Of course in this case it is $m=3$ , $r=9$ amd $0 \le s \le 27$.
