How to calculate the total number of possible triangles where the perimeter is given, and all sides are integers? How would I go about calculating the total number of possible triangles where the perimeter is given, and all sides are integers?
Exempli gratia:


*

*$a + b + c = 15$

*$d + e + f = 16$

*$x + y + z = 100$


Let ${\cal S}_p$ be the set of ordered triples $(a,b,c) \in \mathbb{N}^3$ such that $c \ge b \ge a \ge 1$, $a+b+c=p$, and $a+b > c$ (the triangle inequality).  For instance, ${\cal S}_3 = \{ (1,1,1) \}$ and ${\cal S}_4 = \{ \}$.  Each triple in ${\cal S}_{p-2}$ gives rise to a triple in ${\cal S}_{p}$ under the transformation $(a,b,c)\rightarrow(a,b+1,c+1)$, and all triples in ${\cal S}_{p}$ are produced by this transformation except for those of the form $(a,a,c)$.  These latter triples can be counted directly: there is one for each value of $a$ for which $3a \le p < 4a$, and so there are exactly $I_p = \lfloor{p/3}\rfloor - \lceil{(p+1)/4}\rceil + 1$ of them.  So we have the recurrence $S_p = S_{p-2} + I_p$ for the values of $S_p = |{\cal S}_p|$, with initial conditions $S_0=S_1=0$.  The addend has period $12$, and takes on values
$$
I_{12k+(0,1,2,...,11)} = k + (0,0,0,1,0,0,1,1,0,1,1,1).
$$
We then have $S_{12(k+1)} = S_{12k} + 6k + 3$ and $S_{12(k+1)+1} = S_{12k+1} + 6k + 5$, leading to quadratic solutions $S_{12k} = 3k^2$ and $S_{12k+1} = 3k^2 + 2k$.  The full set of solutions is
$$
\begin{eqnarray}
S_{12k} &=& 3k^2 \\
S_{12k+1} &=& 3k^2 + 2k \\
S_{12k+2} &=& 3k^2 + k \\
S_{12k+3} &=& 3k^2 + 3k + 1\\
S_{12k+4} &=& 3k^2 + 2k \\
S_{12k+5} &=& 3k^2 + 4k + 1 \\
S_{12k+6} &=& 3k^2 + 3k + 1 \\
S_{12k+7} &=& 3k^2 + 5k + 2 \\
S_{12k+8} &=& 3k^2 + 4k + 1 \\
S_{12k+9} &=& 3k^2 + 6k + 3 \\
S_{12k+10} &=& 3k^2 + 5k + 2 \\
S_{12k+11} &=& 3k^2 + 7k + 4.
\end{eqnarray}
$$
Note that, as noted elsewhere, for all odd $p$ we have $S_{p} = S_{p+3}$.
