Triangles with integer sides a,b,c (a =< b =< c) all have perimeter p.
As example, if p = 13, there are 5 triangles:
I believe this "program coding" gets them all the quickest way:
IF p is even THEN sa = 2 ELSE sa = 1 (sa means start a)
LOOP a FROM sa TO INT(p/3)
sb = INT[(p - 2a) / 2] + 1 : IF sb < a THEN sb = a (sb means start b)
LOOP b FROM sb TO INT[(p - a) / 2]
c = p - a - b
n = n + 1 (count them!)
PRINT a,b,c (if one wishes!)
Can someone confirm that this gets 'em all? Thank you.