Question: Pythagorean Triples: right triangle can have sides that are all integers. sct of three integer values for the sides of a right triangle is called
Pythagorean Triples: right triangle can have sides that are all integers. sct of three integer values for the sides of a right triangle is called a Pythagorean triple. These three sides must satisfy the relationship that the sum of the squares of two of the sides is equal to the square of the hypotenuse. Find all unique Pythagorean triples for sidel, side2 and hypotenuse, all no longer than 500 . How many are there? Note that this problen specifically asks you to exclude the duplicates, unlike the one on p.167 of the slides. For example, if you were to check all unique Pythagorean Triples less than 5 (rather than 500 ) your output must. be 345 That is, it must NOT output both (3,4,5) and (4,3,5). Sample Output: Number of Pythagorean Trples with duplicates : 772 The Innermost for 100p is entered 125000000 times. Number of Pythagorean Triples (no duplicates) : 386 The Innermost for 100p is entered 20708500 times
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
