A is the set of all triangles whose perimeter is 2013. B is the set of all triangles whose perimeter is 2016. Which set has more triangles.

Let A be the set of all triangles whose lengths of sides are integers and whose perimeter is $2013$. Let B be the set of all triangles whose lengths of sides are integers and perimeter is $2016$. Which of the two sets has more elements (triangles). Explain it in details.

What I tried:

I couldn't count the number of triangles for both sets. Supposing that triangles exist they must comply with the triangle inequality. According to the triangle inequality for set A the sides of the triangles are from 1 to 1006, for set B the sides of the triangles are from 2 to 1007. In both cases the possible length side values are 1006.

Can somebody give me an idea?

• According to the triangle inequality, no triangle in set $A$ can have a side longer than $1006.$ The longest side must be shorter than the sum of the lengths of the other two sides. – saulspatz Aug 13 '18 at 21:30
• Technically, the way it's stated each set has cardinality $\mathfrak{c}$ (since the problem statement isn't saying to consider congruent triangles as being identified in the enumeration). – Daniel Schepler Aug 13 '18 at 21:35
• I assumed that two triangles are considered equivalent if the lengths of their sides are the same (i.e. they are congruent, perhaps up to a flip). Whether or not this is to be assumed should part of the question. – Arnaud Mortier Aug 13 '18 at 21:50
• I am sorry I saw the mistake but I can't edit the question. I wanted to replace 2006 with 1006 and 2007 with 1007. – john1672 Aug 13 '18 at 22:12
• @john1672 you can always edit your own question by following the link underneath the question. – Arnaud Mortier Aug 13 '18 at 23:16

Take a triangle from $A$ and add $1$ to each side. The triangle inequality still holds (because $1 <1+1$) and you have an element from $B$. This map is injective but not surjective because $B$ has flat triangles (since $2016$ is even).
Edit: As noted by @Daniel Schepler in the comments, there are no non-flat triangles with a side of length $1$ in $B$, so the map above is actually a bijection if flat triangles are forbidden.
• I guess it's unclear from the problem statement whether degenerate triangles are admissible or not - but I would usually tend to exclude them. On the other hand, any triangle from $B$ with a side length of 1 can't be in the image (or with a side length of 0 if you're allowing degeneracy to go that far)... – Daniel Schepler Aug 13 '18 at 21:37
• Actually, I guess if you're only considering nondegenerate triangles (modulo congruence) then the two sets are in bijection - if $c$ is the longest side, then $a+b-c \equiv a+b+c = 2016 \pmod{2}$ so $a+b-c \ge 2$, implying that $a-1,b-1,c-1$ forms a valid triangle in $A$. – Daniel Schepler Aug 13 '18 at 21:53
Hint: categorize the triangles by the longest side. For a perimeter of $2016$ the longest side cannot be longer than $1007$ because the triangle inequality will fail. It can't be shorter than $672$ because another side will be longer. If I tell you the longest side is $1234$ how many triangles can you form? Find the rule for the number given the longest side and add up the results for longest sides from $672$ to $1007$