# An easy math/programming puzzle.

Ryan McGuire
Ranch Hand
Posts: 1078
4
You have your choice of writing a program to solve this one or just doing it in your head.

How many different right triangles with all integer sides have one side of length 60?

Ryan

Arjunkumar Shastry
Ranch Hand
Posts: 986
Side or hypotenuse of length 60? Anyway,following program prints some of the triplets.

The above program prints only prime triplets.For example,(3,4,5) but not (6,8,10).If any prime triplet contains the factor of 60,then prime triplet can be converted to corresponding triplet which will have a side of 60.
From i=2 to i=1000,I was able to find only four prime triplets:
(11,60,61)
(60,91,109)
(60,221,229)
(60,899,901)
Some of the interesting facts about prime triplets:
(x,y) = (y,z) = (z,x) = 1 where (x,y)--> gcd of x & y.
Only one of x,y,z is even.Other two are odd.
[ May 08, 2005: Message edited by: Arjunkumar Shastry ]
[ May 08, 2005: Message edited by: Arjunkumar Shastry ]

Henry Wong
author
Marshal
Posts: 21489
84
Originally posted by Ryan McGuire:
You have your choice of writing a program to solve this one or just doing it in your head.

How many different right triangles with all integer sides have one side of length 60?

Ryan

Well, I don't know if it is possible to calculate all of them in you head, but this is what I got from writing a program to calculate it.

Henry

Marc Peabody
pie sneak
Sheriff
Posts: 4727
Originally posted by Ryan McGuire:
You have your choice of writing a program to solve this one or just doing it in your head.

How many different right triangles with all integer sides have one side of length 60?

Ryan

If the 60-side is not the hypotenuse, I think there are infinite possibilites. The other two sides could approach infinity and still make a right triangle.

Henry Wong
author
Marshal
Posts: 21489
84
Originally posted by Marc Peabody:

If the 60-side is not the hypotenuse, I think there are infinite possibilites. The other two sides could approach infinity and still make a right triangle.

There may be infinite possibilities for right triangles, but they can't satisfy the criteria.

As one side, and the hypotenuse, grows toward infinitely... the smallest the hypotenuse can be is the growing side plus one. And as this number gets bigger, this small plus one will cause the third side to be much greater than 60 to try to satisfy the condition.

Henry

fred rosenberger
lowercase baba
Bartender
Posts: 12196
35
I think there are infinite possibilites.

i don't think that's true. eventually, you will reach the point where if one leg is x, and the hypotenuse is x+1, the difference between the two will be more than 60^2. and, any hypotenuse more than 1 greater will result in a bigger difference...

i haven't done any math, but i think i'm right...

Timmy Marks
Ranch Hand
Posts: 226
Consider:

60^2 + x^2 = (x+n)^2
3600 + x^2 = x^2 + 2xn + n^2
(3600 - n^2)/2n = x

Since n^2 >= 2n when n > 1, and the smallest difference between x and n is 1, then the largest possible x is when n is 1. That would mean that for all triangles fulfilling the requirements, x < 1800

Henry Wong
author
Marshal
Posts: 21489
84
Originally posted by Timmy Marks:
Consider:

60^2 + x^2 = (x+n)^2
3600 + x^2 = x^2 + 2xn + n^2
(3600 - n^2)/2n = x

Since n^2 >= 2n when n > 1, and the smallest difference between x and n is 1, then the largest possible x is when n is 1. That would mean that for all triangles fulfilling the requirements, x < 1800

Thanks... I had some complex formula to determine whether to stop or not. This formula is much easier to use...

Henry
[ May 09, 2005: Message edited by: Henry Wong ]

Arjunkumar Shastry
Ranch Hand
Posts: 986
The last triplet which contains 60 seems to be now (60,899,901).

Ryan McGuire
Ranch Hand
Posts: 1078
4
Originally posted by Henry Wong:

Well, I don't know if it is possible to calculate all of them in you head, but this is what I got from writing a program to calculate it.

I did them all in my head but had to use paper to keep track of them as I found them.

The way I looked at it was that 60^2 had to be enough to pad one square out to the size of another. To do this, 3600 had to be cut up into three pieces: two that are as long as the smaller square and n wide, plus a small n*n block. For instance, when n=2, the small 2*2 block takes 4 out of the 3600 leaving 3596. That means that 3594 had to make two 2*something blocks. That "something" is 3596/4 or 899. That make 60/899/901 a solution.

As a negative example... when n=3, n^2=9, leaving 3591. You can't split 3599 into two equal 3*(some integer) pieces. This can be said about all odd values for n.

Or, more "algorithmically",...

You might recognize that formula for x from what Timmy Marks posted. Why did I stop at n<=25? Because I don't have 26^2 memorized.

The first five (plus 60/80/100) are just multiples of 3/4/5, 5/12/13, or 8/15/17 triangles.

Ryan