Project Euler 39 - Integer right triangles
Project Euler 39 - Integer right triangles
Official link: https://projecteuler.net/problem=39
Thought Process
Thought Process
I modified my code from Problem 9 and modified my Primitive Pythagorean Triples(PPT) function.
I create an array = [0]*1001, I use my modified PPT function store the number of times a perimeter occurs, that is for every perimeter, p, formed, array[p] += 1, at the end I will have an array where array[x] represents the number of pythagorean triangle perimeters that are equal to x, I simply need to return the index of the maximum of this array
Interactive Code
Interactive Code
Input an integer (yourinput)
Code will output the values of p <= yourinput where the number of solutions is maximised