|
Pythagorean Triples
|
|
09-19-2009, 05:37 PM
Post: #1
|
|||
|
|||
|
Pythagorean Triples
Every triangle with one angle 90 degrees has 3 sides that must satisfy relationship that sum of the squares of 2 sides equals to the square of the hypotenuse. For example (3,4,5) is a Pythagorean triple because
sqr(3)+sqr(4)=sqr(5) or 9+16=25 Your task is to find triples that are not bigger than 20, and you need to calculate repetition inside of this algorithm ! And you need to sort triples from smallest to biggest ! So here is the code in TPW : Code: program pythagorean_triples;3 4 5 5 12 13 6 8 10 8 15 17 9 12 15 12 16 20 There's a fine line between genius and insanity. I have erased this line. Oscar Levant There's a fine line between an administrator and black hat hacker. I have erased this line. Dr DEBCOL |
|||
|
12-19-2009, 07:09 AM
Post: #2
|
|||
|
|||
|
RE: Pythagorean Triples
Since i didn't write mathematical formulation of Pythagorean Triples, i'll do it now.
Pythagorean Triple is a triple from natural number triples which has a condition of satisfying Pythagorean theorem. More about Natural numbers (set of Natural numbers N) you can find here : http://en.wikipedia.org/wiki/Natural_number And about Pythagorean theorem, you can find here : http://en.wikipedia.org/wiki/Pythagorean_theorem So mathematical formulation would look like this : ![]() Where N^3 is a sign for triple in set of Natural numbers. V is mathematical "or". So set of triples "S" are all Pythagorean Triples that can be generated in set of Natural numbers. There's a fine line between genius and insanity. I have erased this line. Oscar Levant There's a fine line between an administrator and black hat hacker. I have erased this line. Dr DEBCOL |
|||
|
« Next Oldest | Next Newest »
|






![[Image: 26651_pythagoreantriples.jpg]](http://myph.us/pics/26651_pythagoreantriples.jpg)