Project Euler 279 - Triangles with integral sides and an integral angle

Official link:

Thought Process

So we can break it down into different cases, If we have an internal angle of 90 degrees, this is a pythagorean triple, which we have discussed how to generate before.

Using this very useful page: we can parameterise the other 2 cases as well

Case 1 still has a tricky case, if a, b, c are all divisible by 3, in that case we just divide the given perimeter by 3

Interactive Code

Enter a number (yourinput)

Code will output the number of triangles with integral sides, and at least one integral angle (measured in degrees), and a perimeter that does not exceed yourinput