Combinatorics of the sum of two dice In my probability book I learned how to solve this kind of problem: how many vectors of the form $(i_1,i_2,...,i_r)$ exist that the sum of its components is $n$ and $i_k>0$ for all $k$? The answer uses the stars and bars argument and is $n-1\choose r-1$.
OK, now I have this really simple problem: imagine you'll roll $2$ six-faced dice, how many ways there are in which the sum of them is $n$? 
First I thought to use the before mentioned method, considering a result as a vector of the form $(i_1,i_2)$ but I realized that I have a new restriction, $i_1,i_2 \leq 6$! I thought about it and I don't know how to compute it without considering case by case ($n=2,n=3,...,n=12$), I've done it with the six-faced die, since there's only $11$ cases and found a nice 'triangular pattern', but what if the dice had each $20$ faces? Is there a more smart way to calculate it?
 A: Hint:
This might help. 
$$\begin{array}{|l|l|l|l|l|l|l|}
\hline
  & \color{red}1 & \color{red}2 & \color{red}3 & \color{red}4  & \color{red}5  & \color{red}6  \\ \hline
\color{red}1 & 2 & 3 & 4 & 5  & 6  & 7  \\ \hline
\color{red}2 & 3 & 4 & 5 & 6  & 7  & 8  \\ \hline
\color{red}3 & 4 & 5 & 6 & 7  & 8  & 9  \\ \hline
\color{red}4 & 5 & 6 & 7 & 8  & 9  & 10 \\ \hline
\color{red}5 & 6 & 7 & 8 & 9  & 10 & 11 \\ \hline
\color{red}6 & 7 & 8 & 9 & 10 & 11 & 12 \\ \hline
\end{array}$$

Let $n$ be your sum, then notice that


*

*if $n\leq 6$, then there are $n-1$ ways to make a sum equal to $n$.

*if $n\geq 7$, then there are $13-n$ ways to make a sum equal to $n$.


We can jusify this as follows. Say you want to pick two numbers $a,b$ so that $$a+b=n$$ We can only focus on $a$, since for a fixed $a$ we know that $b=n-a$. The smallest value for $a$ is $1$, and the largest value for $a$ is therefore $n-1\geq n-a$. Thus there are $n-1$ ways to choose $a$ (and we have no choice for $b$).
We get the other case by symmetry: $12-(n-1)$.
A: Six-sided dice problem:
Suppose we have a red die and a white die.  If we denote the number shown on the red die by $x_r$ and the number shown on the white die by $x_w$, then the sum of the numbers on the two dice satisfies
$$x_r + x_w = n \tag{1}$$
where $x_r$ and $x_w$ are positive integers.  For six-sided dice, we have the additional restriction that $x_r, x_w \leq 6$.  Without that restriction, equation 1 has 
$$\binom{n - 1}{2 - 1} = \binom{n - 1}{1} = n - 1$$
solutions in the positive integers. From these, we must subtract those solutions in which one of the variables exceeds $6$.
If $n \leq 7$, this is impossible, so there are simply $n - 1$ solutions.
Suppose $n > 7$.  Moreover, suppose $x_r \geq 7$.  Then $x_r' = x_r - 6$ is a positive integer.  Substituting $x_r' + 6$ for $x_r$ in equation 1 yields
\begin{align*}
x_r' + 6 + x_w & = n\\
x_r' + x_w & = n - 6 \tag{2}
\end{align*}
Equation 2 is an equation in the positive integers with 
$$\binom{n - 6 - 1}{1} = \binom{n - 7}{1} = n - 7$$
solutions.  By symmetry, equation 1 also has $n - 7$ solutions in the positive integers with $x_w > 6$.  
Hence, the number of ways two six-sided dice can have sum $n > 7$ is 
$$n - 1 - 2(n - 7) = n - 1 - 2n + 14 = 13 - n$$
The approach is analogous for $20$-sided dice.
A: If the first die shows $d$, the other must show $n-d$. You must fulfill the constraints
$$1\le d\le6,\\1\le n-d\le 6$$ or 
$$\max(1,n-6)\le d\le\min(6,n-1).$$
The requested number is
$$\min(6,n-1)-\max(1,n-6)+1.$$

In a simpler way,
$$2=1+1,
\\3=2+1|1+2,
\\4=3+1|2+2|1+3,
\\5=4+1|3+2|2+3|1+4,
\\\cdots$$
