Re: JonFer's Thread from Feb 18th
thread1551-1531677
The question being:
Assuming that the integer provided for the Hypotenuse has a valid solution of 2 integer values for the other sides I would use the following method.
I have a formula that I use to calculate the difference between 2 known squares.
Difference = (A + B) X (A - B)
For the premise of this challenge to work, the difference in this case must be a perfect square. Also the Difference Squared must exceed the value of the Hypotenuse.
C[sup]2[/sup] = (A + B) X (A - B)
Case using 10 as the hypotenuse:
10+9*1 = 19 (not a perfect square)
10+8*2 = 36 (works - result 10-8-6)
10+7*3 = 51 nope
6 = Not required already solved above
10+5*5 = 75 nope
10+4*6 = 84 nope
Using this method I can quickly tell the following triplets and ignoring multiples of 3-4-5
13-12-5
17-8-5
25-24-7
26-10-24
29-20-21
Above 30 I can no longer do it quickly
I can more quickly determine a triplet when the number provided is a short side and odd. e.g.
3-4-5
5-12-13
7-24-25
9-41-40
11-61-60
13-84-85
*******************************************************
Occam's Razor - All things being equal, the simplest solution is the right one.
thread1551-1531677
The question being:
Given an integer representing the length of the hypotenuse of one or more right triangles, how can you determine the various integer sides that can be drawn for that hypotenuse?
Assuming that the integer provided for the Hypotenuse has a valid solution of 2 integer values for the other sides I would use the following method.
I have a formula that I use to calculate the difference between 2 known squares.
Difference = (A + B) X (A - B)
For the premise of this challenge to work, the difference in this case must be a perfect square. Also the Difference Squared must exceed the value of the Hypotenuse.
C[sup]2[/sup] = (A + B) X (A - B)
Case using 10 as the hypotenuse:
10+9*1 = 19 (not a perfect square)
10+8*2 = 36 (works - result 10-8-6)
10+7*3 = 51 nope
6 = Not required already solved above
10+5*5 = 75 nope
10+4*6 = 84 nope
Using this method I can quickly tell the following triplets and ignoring multiples of 3-4-5
13-12-5
17-8-5
25-24-7
26-10-24
29-20-21
Above 30 I can no longer do it quickly
I can more quickly determine a triplet when the number provided is a short side and odd. e.g.
3-4-5
5-12-13
7-24-25
9-41-40
11-61-60
13-84-85
*******************************************************
Occam's Razor - All things being equal, the simplest solution is the right one.