Well, problem number 9 was an interesting return to the world of Pythagoras. If you haven't looked at the riddle, here it is:

Find the only Pythagorean triplet, {

`a`,

`b`,

`c`}, for which

`a`+

`b`+

`c`= 1000.

OK. The first thing we know is that

`a`

^{2}+

`b`

^{2}=

`c`

^{2}is Pythagorean Theorem.

Now to find Pythagorean Triplets with positive whole numbers(natural numbers) we could try iterating through the infinite set of number until we found the right set or we could use this formula:

`a`= 2

`mn`

`b`=

`m`

^{2}-

`n`

^{2}

`c`=

`m`

^{2}+

`n`

^{2}

where m > n > 0

So now we have:

1000 = a + b + c

1000 = (2

1000 = 2

500 =

500 =

(500/

(500/

You now have what you need to write a program to find your triplet. I'll give you my inplementation later.

1000 = (2

`mn`) + (`m`^{2}-`n`^{2}) + (`m`^{2}+`n`^{2})1000 = 2

`mn`+ 2`m`^{2}+ 0500 =

`mn`+`m`^{2}500 =

`m`(`n`+`m`)(500/

`m`) =`n`+`m`(500/

`m`) -`m`=`n`

You now have what you need to write a program to find your triplet. I'll give you my inplementation later.

## No comments:

Post a Comment