# Integer solutions to linear equation – Triangle with set perimeter

We have a triangle with the sides a, b and c where:

       / \
/    \
a  /       \   b
/          \
/             \
/________________\

c


$\ P = a+b+c$

$\ a+b > c$ else it's not a triangle

$\ a,b,c < P$ no side can be negative

P is known and I'm trying to find all integer solutions of (a,b,c).

By plotting $\ c = P - a - b$ we get a plane where a triangle shows all positive solutions. The solutions where $\ a+b > c$ valid is the the bottom part of this triangle. More I don't know.

EDIT

I'm looking for all solutions, not only the number of solutions. And if $\ P=12$ I think (3,4,5) and (4,3,5) should be treated like different solutions.

Edit 2

I made an algorithm with C. With help of solutions for a range of vaules for P (See picture) I came up with the following rules:

(note: calling the sides x, y and z now, and now I treat (3,4,5) to be equal with (5,3,4))

Z will vary from (1) to (2)

(1) $Z_0=floor(P/2)$

(2) $Z_m=ceil(P/3)$

For a certain Z will X vary from (3) to (4)

(3) $X_0=Z$

(4) $X_m=floor((P-Z)/2)$

-
I get that you are looking for the count for a given $P$ of the number of solutions in positive integers of $x+y+z=P$ for which $x+y>z$ and $y+z>x$ and $z+x>y$. This is likely not too hard to get a formula for, but it makes a difference whether you are counting the ordered triples $(x,y,z)$ or simply the multisets $\{x,y,z\}$ for your solution count. For example if $P=12$ are you counting $(3,4,5)$ as different from $(4,3,5)$ or not? – coffeemath Nov 13 '12 at 21:24

Are you trying to find all the integer solutions, or will you settle for the number of integer solutions? The latter is given at this link.

EDIT: I'll indicate a systematic way to list all the solutions for $P=101$, and leave it to you to code it:

50 50 1; 50 1 50; 1 50 50.

50 49 2; 50 2 49; 49 50 2; 49 2 50; 2 50 49; 2 49 50.

50 48 3; etc.

.

.

.

49 49 3; 49 3 49; 3 49 49.

49 48 4; 49 4 48; 48 49 4; 48 4 49; 4 49 48; 4 48 49.

.

.

.

34 34 33; 34 33 34; 33 34 34.

-
Thanks! But I'm looking for all solutions, not only the count. – Johannes Lund Nov 14 '12 at 8:13
If you're looking to list all the solutions, then it's more of a programming problem than a mathematics problem. Suggest you visit the coding site. – Gerry Myerson Nov 14 '12 at 10:55