[Combinatorics]
Problem: For each positive integer $n$, let $T(n)$ be the number of triangles with integer side lengths, positive area, and perimeter $n$. For example, $T(6)=1$ since the only such triangle with a perimeter of 6 has side lengths 2,2 and 2 .
Determine the smallest positive integer $n$ such that $T(n)>2010$.

Solution: Denote the side lengths of a triangle by $a, b$ and $c$, with $0<a \leq b \leq c$.

In order for these lengths to form a triangle, we need $c<a+b$ and $b<a+c$ and $a<b+c$. Since $0<a \leq b \leq c$, then $b<a+c$ and $a<b+c$ follow automatically, so only $c<a+b$ ever needs to be checked.

Instead of directly considering triangles and sets of triangle, we can consider triples $(a, b, c)$ and sets of triples $(a, b, c)$ with the appropriate conditions.

For each positive integer $k \geq 3$, we use the notation $S_{k}$ to denote the set of triples of positive integers $(a, b, c)$ with $0<a \leq b \leq c$ and $c<a+b$ and $a+b+c=k$.

In this case, $c<a+b$ and $a+b+c=k$, so $c+c<a+b+c=k$, so $2 c<k$ or $c<\frac{1}{2} k$.

Also, if $0<a \leq b \leq c$ and $a+b+c=k$, then $k=a+b+c \leq c+c+c$, so $3 c \geq k$ or $c \geq \frac{1}{3} k$.


We will use two important facts:

(F1) $T(2 m)=T(2 m-3)$ for every positive integer $m \geq 3$, and

(F2) $T(k) \leq T(k+2)$ for every positive integer $k \geq 3$

First, we prove (F1):


We show that $T(2 m)=T(2 m-3)$ by creating a one-to-one correspondence between the triples in $S_{2 m}$ and the triples $S_{2 m-3}$.

Note that $S_{2 m}$ is the set of triples $(a, b, c)$ of positive integers with $0<a \leq b \leq c$, with $c<a+b$, and with $a+b+c=2 m$.

Also, $S_{2 m-3}$ is the set of triples $(A, B, C)$ of positive integers with $0<A \leq B \leq C$, with $C<A+B$, and with $A+B+C=2 m-3$.

Consider a triple $(a, b, c)$ in $S_{2 m}$ and a corresponding triple $(a-1, b-1, c-1)$.

We show that $(a-1, b-1, c-1)$ is in $S_{2 m-3}$ :

* Since $(a, b, c)$ is in $S_{2 m}$, then $c<\frac{1}{2}(2 m)=m$. This means that $b \leq c \leq m-1$, so $a=2 m-b-c \geq 2$. Therefore, $a-1, b-1$ and $c-1$ are positive integers since $a, b$ and $c$ are positive integers with $2 \leq a \leq b \leq c$.
* Since $2 \leq a \leq b \leq c$, then $1 \leq a-1 \leq b-1 \leq c-1$, so $0<a-1 \leq b-1 \leq c-1$.
* Since $a+b+c=2 m$, then $c=2 m-(a+b)$ so $a+b$ and $c$ have the same parity.

Since $c<a+b$, then $c \leq a+b-2$. (In other words, it cannot be the case that $c=a+b-1$.) Therefore, $c-1 \leq(a-1)+(b-1)-1$; that is, $c-1<(a-1)+(b-1)$.

$*$ Since $a+b+c=2 m$, then $(a-1)+(b-1)+(c-1)=2 m-3$.

Therefore, $(a-1, b-1, c-1)$ is in $S_{2 m-3}$, since it satisfies all of the conditions of $S_{2 m-3}$. Note as well that two different triples in $S_{2 m}$ correspond to two different triples in $S_{2 m-3}$. Thus, every triple in $S_{2 m}$ corresponds to a different triple in $S_{2 m-3}$.

Thus, $T(2 m) \leq T(2 m-3)$.

Consider a triple $(A, B, C)$ in $S_{2 m-3}$ and a corresponding triple $(A+1, B+1, C+1)$. We show that $(A+1, B+1, C+1)$ is in $S_{2 m}$ :

* Since $(A, B, C)$ is in $S_{2 m-3}$, then $A, B$ and $C$ are positive integers, so $A+1, B+1$ and $C+1$ are positive integers.
* Since $0<A \leq B \leq C$, then $1<A+1 \leq B+1 \leq C+1$, so $0<A+1 \leq B+1 \leq C+1$.
* Since $C<A+B$, then $C+1<(A+1)+(B+1)-1$ so $C+1<(A+1)+(B+1)$.
* Since $A+B+C=2 m-3$, then $(A+1)+(B+1)+(C+1)=2 m$.

Therefore, $(A+1, B+1, C+1)$ is in $S_{2 m}$.

Note again that two different triples in $S_{2 m-3}$ correspond to two different triples in $S_{2 m}$. Thus, every triple in $S_{2 m-3}$ corresponds to a different triple in $S_{2 m}$.

Therefore, $T(2 m-3) \leq T(2 m)$.

Since $T(2 m) \leq T(2 m-3)$ and $T(2 m-3) \leq T(2 m)$, then $T(2 m)=T(2 m-3)$.


Next, we prove (F2):

Consider a triple $(a, b, c)$ in $S_{k}$ and a corresponding triple $(a, b+1, c+1)$. We show that the triple $(a, b+1, c+1)$ is in $S_{k+2}$ :

* Since $a, b$ and $c$ are positive integers, then $a, b+1$ and $c+1$ are positive integers.



* Since $0<a \leq b \leq c$, then $0<a \leq b+1 \leq c+1$.
* Since $c<a+b$, then $c+1<a+(b+1)$.

$*$ Since $a+b+c=k$, then $a+(b+1)+(c+1)=k+2$.

Therefore, $(a, b+1, c+1)$ is in $S_{k+2}$. Note that, using this correspondence, different triples in $S_{k}$ correspond different triples in $S_{k+2}$. Thus, every triple in $S_{k}$ corresponds to a different triple in $S_{k+2}$. This proves that $T(k) \leq T(k+2)$.

Suppose that $n=N$ is the smallest positive integer for which $T(n)>2010$.

Then $N$ must be odd:

If $N$ was even, then by (F1), $T(N-3)=T(N)>2010$ and so $n=N-3$ would be an integer smaller than $N$ with $T(n)>2010$. This contradicts the fact that $n=N$ is the smallest such integer.

Therefore, we want to find the smallest odd positive integer $N$ for which $T(N)>2010$. Next, we note that if we can find an odd positive integer $n$ such that $T(n)>2010 \geq$ $T(n-2)$, then we will have found the desired value of $n$ :

This is because $n$ and $n-2$ are both odd, and by property (F2), any smaller odd positive integer $k$ will give $T(k) \leq T(n-2) \leq 2010$ and any larger odd positive integer $m$ will give $T(m) \geq T(n)>2010$.

We show that $N=309$ is the desired value of $N$ by showing that $T(309)>2010$ and $T(307) \leq 2010$.

Calculation of $T(309)$

We know that $\frac{309}{3} \leq c<\frac{309}{2}$, so $103 \leq c \leq 154$.

For each admissible value of $c$, we need to count the number of pairs of positive integers $(a, b)$ with $a \leq b \leq c$ and $a+b=309-c$.

For example, if $c=154$, then we need $a \leq b \leq 154$ and $a+b=155$.

This gives pairs $(1,154),(2,153), \ldots,(76,79),(77,78)$, of which there are 77 .

Also, if $c=153$, then we need $a \leq b \leq 153$ and $a+b=156$.

This gives pairs $(3,153), \ldots,(77,79),(78,78)$, of which there are 76 .

In general, if $c$ is even, then the minimum possible value of $a$ occurs when $b$ is as large as possible - that is, when $b=c$, so $a \geq 309-2 c$.

Also, the largest possible value of $a$ occurs when $a$ and $b$ are as close to equal as possible. Since $c$ is even, then $309-c$ is odd, so $a$ and $b$ cannot be equal, but they can differ by 1 . In this case, $a=154-\frac{1}{2} c$ and $b=155-\frac{1}{2} c$.

Therefore, if $c$ is even, there are $\left(154-\frac{1}{2} c\right)-(309-2 c)+1=\frac{3}{2} c-154$ possible pairs $(a, b)$ and so $\frac{3}{2} c-154$ possible triples.

In general, if $c$ is odd, then the minimum possible value of $a$ occurs when $b$ is as large as possible - that is, when $b=c$, so $a \geq 309-2 c$.

Also, the largest possible value of $a$ occurs when $a$ and $b$ are as close to equal as possible.

Since $c$ is odd, then $309-c$ is even, so $a$ and $b$ can be equal. In this case, $a=\frac{1}{2}(309-c)$. Therefore, if $c$ is odd, there are $\frac{1}{2}(309-c)-(309-2 c)+1=\frac{3}{2} c-\frac{307}{2}$ possible pairs $(a, b)$ and so $\frac{3}{2} c-\frac{307}{2}$ possible triples.

The possible even values of $c$ are 104,106,...,152,154 (there are 26 such values) and the possible odd values of $c$ are 103,105,...,151,153 (there are 26 such values).



Therefore,

$$
\begin{aligned}
T(309)= & \left(\frac{3}{2}(104)-154\right)+\left(\frac{3}{2}(106)-154\right)+\cdots+\left(\frac{3}{2}(154)-154\right)+ \\
& \quad\left(\frac{3}{2}(103)-\frac{307}{2}\right)+\left(\frac{3}{2}(105)-\frac{307}{2}\right)+\cdots+\left(\frac{3}{2}(153)-\frac{307}{2}\right) \\
= & \frac{3}{2}(104+106+\cdots+154)-26 \cdot 154+\frac{3}{2}(103+105+\cdots+153)-26 \cdot \frac{307}{2} \\
= & \frac{3}{2}(103+104+105+106+\cdots+153+154)-26 \cdot 154-26 \cdot \frac{307}{2} \\
= & \frac{3}{2} \cdot \frac{1}{2}(103+154)(52)-26 \cdot 154-26 \cdot \frac{307}{2} \\
= & \frac{3}{2}(26)(257)-26 \cdot 154-26 \cdot \frac{307}{2} \\
= & 2028
\end{aligned}
$$

Therefore, $T(309)>2010$, as required.

Calculation of $T(307)$

We know that $\frac{307}{3} \leq c<\frac{307}{2}$, so $103 \leq c \leq 153$.

For each admissible value of $c$, we need to count the number of pairs of positive integers $(a, b)$ with $a \leq b \leq c$ and $a+b=307-c$.

This can be done in a similar way to the calculation of $T(309)$ above.

If $n$ is even, there are $\frac{3}{2} c-153$ possible triples.

If $n$ is odd, there are $\frac{3}{2} c-\frac{305}{2}$ possible triples.

The possible even values of $c$ are $104,106, \ldots, 150,152$ (there are 25 such values) and the possible odd values of $c$ are $103,105, \ldots, 151,153$ (there are 26 such values).

Therefore,

$$
\begin{aligned}
T(307)= & \left(\frac{3}{2}(104)-153\right)+\left(\frac{3}{2}(106)-153\right)+\cdots+\left(\frac{3}{2}(152)-153\right)+ \\
& \quad\left(\frac{3}{2}(103)-\frac{305}{2}\right)+\left(\frac{3}{2}(105)-\frac{305}{2}\right)+\cdots+\left(\frac{3}{2}(153)-\frac{305}{2}\right) \\
= & \frac{3}{2}(104+106+\cdots+152)-25 \cdot 153+\frac{3}{2}(103+105+\cdots+153)-26 \cdot \frac{305}{2} \\
= & \frac{3}{2}(103+104+105+106+\cdots+152+153)-25 \cdot 153-26 \cdot \frac{305}{2} \\
= & \frac{3}{2} \cdot \frac{1}{2}(103+153)(51)-25 \cdot 153-26 \cdot \frac{305}{2} \\
= & \frac{3}{2}(51)(128)-25 \cdot 153-26 \cdot \frac{305}{2} \\
= & 2002
\end{aligned}
$$

Therefore, $T(307)<2010$, as required.

Therefore, the smallest positive integer $n$ such that $T(n)>2010$ is $n=309$.

As a final note, we discuss briefly how one could guess that the answer was near $N=309$.

Consider the values of $T(n)$ for small odd positive integers $n$.

In (a), by considering the possible values of $c$ from smallest (roughly $\frac{1}{3} n$ ) to largest (roughly $\frac{1}{2} n$ ), we saw that $T(11)=1+3=4$.

If we continue to calculate $T(n)$ for a few more small odd values of $n$ we will see that:

$$
\begin{aligned}
& T(13)=2+3=5 \\
& T(15)=1+2+4=7 \\
& T(17)=1+3+4=8 \\
& T(19)=2+3+5=10 \\
& T(21)=1+2+4+5=12 \\
& T(23)=1+3+4+6=14
\end{aligned}
$$



The pattern that seems to emerge is that for $n$ odd, $T(n)$ is roughly equal to the sum of the integers from 1 to $\frac{1}{4} n$, with one out of every three integers removed. Thus, $T(n)$ is roughly equal to $\frac{2}{3}$ of the sum of the integers from 1 to $\frac{1}{4} n$. Therefore, $T(n) \approx \frac{2}{3} \cdot \frac{1}{2}\left(\frac{1}{4} n\right)\left(\frac{1}{4} n+1\right) \approx \frac{2}{3} \cdot \frac{1}{2}\left(\frac{1}{4} n\right)^{2} \approx \frac{1}{48} n^{2}$.

It makes sense to look for an odd positive integer $n$ with $T(n) \approx 2010$.

Thus, we are looking for a value of $n$ that roughly satisfies $\frac{1}{48} n^{2} \approx 2010$ or $n^{2} \approx 96480$ or $n \approx 310$.

Since $n$ is odd, then it makes sense to consider $n=309$, as in the solution above.

Final answer: 309