Project Euler 279 - Triangles with integral sides and an integral angle
Project Euler 279 - Triangles with integral sides and an integral angle
Official link: https://projecteuler.net/problem=279
Thought Process
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: https://en.wikipedia.org/wiki/Integer_triangle#Integer_triangles_with_given_perimeter 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
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