Indian National Olympiad $2000$ Problem $6$ 
For any natural numbers $n$, ( $n \geq 3$), let $f(n)$ denote the number of non-congruent integer-sided triangles with perimeter $n$. Show that
(i) $f(1999) > f (1996)$;
(ii) $f(2000) = f(1997)$.

My proof outline -
for second part -
Let $a,b,c$ be three integer sides for the triangle with perimeter $2000$ then $$a+b+c=2000$$ and by triangular inequality we have that $a+b>c,b+c>a,c+a>b$ so we get that $a,b,c<1000$
Now applying the formula of stars and bars we get that we have a total of ${1000\choose2}$ and since we wwant non congruent we divide this by $3$ ,similarly we do for $f(1997)$ but here answer is coming  ${999\choose2}$ .
So how $f(2000)=f(1997)$
Someone pls point out where is the mistake ?
thankyou
 A: You cannot rely on stars and bars. Stars and bars counts $\{a=600,b=650,c=750\}$ and $\{a=600,b=750,c=650\}$ as separate and in this case these values will permute in $3!=6$ ways, not $3$. On the other hand $\{600,700,700\}$ permutes in $3!/2!=3$ ways, not $6$. So it is clear that you can't obtain the answer by dividing by $3$ (or $6$).

We will denote a triangle by the unordered set containing its sides $\{a,b,c\}$. Let $A_n$ be the set of integer sided non-congruent triangles of perimeter $n$. Then $f(n)=|A_n|$. Define a map$$g:A_{1996}\to A_{1999}\\g(\{a,b,c\})=\{a+1,b+1,c+1\}$$Since $a+b>c\implies (a+1)+(b+1)>(c+1),g$ is well defined.
This map is injective, since$$g(\{a_1,b_1,c_1\})=g(\{a_2,b_2,c_2\})=\{p,q,r\}\\\implies \{a_1,b_1,c_1\}=\{a_2,b_2,c_2\}=\{p-1,q-1,r-1\}$$Thus $f(1999)\ge f(1996)$.

We now try to find a triangle in $A_{1999}$ that is not in $g(A_{1996})$. Let such a triangle be $\{a,b,c\}$, then$$a+b+c=1999\tag{1}$$and $\{a-1,b-1,c-1\}\not\in A_{1996}$. Since the perimeter of $\{a-1,b-1,c-1\}=1999-3=1996$, we require the triangular inequality to fail for $\{a-1,b-1,c-1\}$ i.e.$$(a-1)+(b-1)-(c-1)\le0\implies a+b-c\le 1$$Since $\{a,b,c\}\in A_{1999},a+b-c>0$. This gives$$a+b-c=1\tag{2}$$since $a,b,c$ are integral.
$c=999,a=500=b$ is a solution of $(1),(2)$. Hence we get $f(1999)>f(1996)$.

We can define a similar injection $g_1$ from $A_{1997}\to A_{2000}$. But we run into an issue when we try to find a triangle in $A_{2000}$ that is not in $g_1(A_{1997})$. Equations $(1),(2)$ get modified as$$a+b+c=2000\tag{1'}$$$$a+b-c=1\tag{2'}$$Adding these two we get $2(a+b)=2001$ which is not possible. Hence $f(2000)=f(1997)$.
A: You have misapplied stars and bars here. The quantity $\binom{1000}{2}$ partitions 1001 elements into three pieces. If you wanted to compute $f(2000)$,  you want to partition 2000 elements into three pieces, where each partition has at most 999 elements. Furthermore, to remove double-counting, you cannot simply divide by 3, since for example $(1,1,1)$ is unique for triangles of perimeter $3$.
I would suggest that a different approach be taken. Instead of attempting to compute $f(1997)$ or $f(2000)$ (and similarly for the first part of the exercise), find a way to map a triangle of the smaller perimeter to a triangle of the larger perimeter.
Hint: If $T_n$ denotes the set of sidelengths of such triangles with perimeter $n$, and $(a,b,c) \in T_n$, then $(a+1, b+1, c+1) \in T_{n+3}$. Now try to invert this correspondence. In particular, show why the inversion fails for $n = 1996$ but succeeds for $n = 1997$.
