(Pythagorean Triples) A right triangle can have sides that are all integers. The
ID: 3695840 • Letter: #
Question
(Pythagorean Triples) A right triangle can have sides that are all integers. The set 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 Pythagorean triples for side1, side2, and the hypotenuse all no larger than 500. Use a triple-nested for loop that simply tries all possibilities. This is an example of "bruteforce" computing. It is not aesthetically pleasing to many people. But there are many reasons why these techniques are important. First, with computing power increasing at such a phenomenal pace, solutions that would have taken years or even centuries of computer time to produce with the technology of just a few years ago can now be produced in hours, minutes or even seconds. Recent microprocessor chips can process a billion instructions per second! Second, as you will learn in more advanced computer science courses, there are large numbers of interesting problems for which there is no known algorithmic approach other than sheer brute force. We investigate many kinds of problem-solving methodologies in this book. We will consider many brute-force approaches to various interesting problems. Example Output:
3 4 5
4 3 5
5 12 13
6 8 10
7 24 25
8 6 10
476 93 485
480 31 481
480 88 488
480 108 492
480 140 500
483 44 485
A total of 772 triples were found.
{NEED TYPED. write 1 -C program codes using C program through putty program only , 2- flowchart snd pseudocode, 3- screen shot of the output from putty program.}
Explanation / Answer
"Pythagorean triples" are integer solutions to the Pythagorean Theorem, a2 + b2 = c2. I like "triplets," but "triples" seems to be the favored term. For a right triangle, the c side is the hypotenuse, the side opposite the right angle
A Pythagorean triple consists of three positive integers a, b, and c, such that a2 + b2 = c2. Such a triple is commonly written (a, b, c), and a well-known example is (3, 4, 5). If (a, b, c) is a Pythagorean triple, then so is (ka, kb, kc) for any positive integer k. A primitive Pythagorean triple is one in which a, b and c are coprime. A right triangle whose sides form a Pythagorean triple is called aPythagorean triangle.
The name is derived from the Pythagorean theorem, stating that every right triangle has side lengths satisfying the formula a2 + b2 = c2; thus, Pythagorean triples describe the three integer side lengths of a right triangle. However, right triangles with non-integer sides do not form Pythagorean triples. For instance, the triangle with sides a = b = 1 and c = 2 is right, but (1, 1, 2) is not a Pythagorean triple because 2 is not an integer.
There are 16 primitive Pythagorean triples with c 100:
Note, for example, that (6, 8, 10) is not a primitive Pythagorean triple, as it is a multiple of (3, 4, 5). Each of these low-c points forms one of the more easily recognizable radiating lines in the scatter plot.
Additionally these are all the primitive Pythagorean triples with 100 < c 300:
(3, 4, 5) (5, 12, 13) (8, 15, 17) (7, 24, 25) (20, 21, 29) (12, 35, 37) (9, 40, 41) (28, 45, 53) (11, 60, 61) (16, 63, 65) (33, 56, 65) (48, 55, 73) (13, 84, 85) (36, 77, 85) (39, 80, 89) (65, 72, 97)Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.