[Math] Integer Triangles with Perimeter $n$

combinatoricstriangles

How many triangles are possible with positive integer side lengths for perimeter $n$?

My attempt so far has been bashing for $n=1,\; 2, \cdots , 13$ and calculating how many triangles are possible for those specific $n$'s. I found a pattern for when $n$ is odd or even, but haven't really been able to do much more than that.

I think I it would be useful to assume for a triangle $\left ( a,b,c\right )$ that $$ a \leq b \leq c$$ to avoid over counting.

Best Answer

HINT: Let $a,b,c$ denote the lengths of the sides of the triangle. Then we should have $$a+b>c\quad\mbox{and}\quad a+b+c=n.$$ The above two equations implies $a+b-c=n-2c>0$, i.e. $c<n/2$ and similarly $a,b<n/2$. So you need to count the number of triples $(a,b,c)$ such that $0<a\leq b\leq c$ and $a,b,c<n/2$.

EDIT: Note that you only need to find the number of tuples $(a,b)$ such that $0<a\leq b$ and $a,b<n/2$, because $c$ is fixed once you specify $a$ and $b$. Let us consider two cases.

Case (i) $n$ is even: For a fixed $a$, you have the following choices for $b$: $a+1, a+2,\cdots ,n/2-1$, that is $n/2-1-a$ choices. Now $a$ can take values $1,2,\ldots ,n/2-1$. So the number of triangles in this case is $$\sum_{a=1}^{n/2-1}(n/2-1-a)=(n/2-2)+(n/2-3)+\cdots +1=\frac{(n/2-2)(n/2-1)}{2}.$$

Case (ii) $n$ is odd: For a fixed $a$, you have the following choices for $b$: $a+1, a+2,\cdots ,(n-1)/2$, that is $(n-1)/2-a$ choices. Now $a$ can take values $1,2,\ldots ,(n-1)/2$. So the number of triangles in this case is $$\sum_{a=1}^{(n-1)/2}((n-1)/2-a)=((n-1)/2-1)+\cdots +1=\frac{((n-1)/2-1)(n-1)/2}{2}.$$