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$
This is given in A005044.  The generating function is $\frac{x^3}{(1-x^2)(1-x^3)(1-x^4)}$  Some other formulas and references are given as well
An efficient approach can be found with little algebraic manipulation :



Since $a + c &gt; b$ or, $p – b &gt; b$ or, $b &lt; p/2$. Thus iterating $b$ from $1$ to $p/2$, calculating $a$ and storing only the whole number $a$ would give all solutions for a given $p$. There are no right triangles are possible for odd $p$.