# Number of integer triangles with sides 4 or less

Consider triangles having integer sides such that no side is greater than 4 units. How many such triangles are possible?

I suspect a relation to the following question:

How many ways can $r$ things be taken from $n$ with repetition and without regard to order?

• Why are these two sub-questions in the same question? They don't seem very related, unless you extend the $4$ units to some arbitrary number. Also, which one's answer would be more desirable? – астон вілла олоф мэллбэрг Oct 6 '16 at 8:08
• Ok. First one . – ami_ba Oct 6 '16 at 8:12

Without loss of generality, assume that $a \leq b \leq c < a+b$. This leaves us with very few choices.

1) All three could be equal. That gives us four choices.

2) $a=1$. Then, $b+1 > c$, so $b=c$ must happen, this gives three choices.

3) $a=2$. Then, $b \leq c < b+2$, so $b=2$,$c=3$ and $b=3, c=3,4$ , and $b=c=4$ are the possibilities.

4) $a=3$, then $b=3,c=4$ and $b=c=4$ are the only possibilities.

Hence, the total is $4+3+4+2 = 13$ possibilities.

In general, the number $a(n)$ of triangles with positive integer side-lengths of at most $n$ can be computed recursively by $a(n) = a(n-2) + {n+1 \choose 2}$. See OEIS sequence A2623 for more info.

Clearly $a(0)=0$. Then $a(2) = a(0) + {3 \choose 2} = 3$ and $a(4) = a(2) + {5 \choose 2} = 13$. See астон's answer for a case analysis that gives you $13$.