
An interesting problem was posed on theproblemsite.com in the March, 2003
In more detail, here is how the problem was posed:
Exactly four right triangles with integer side lengths exist with a leg equal to 15. These are:
(15, 112, 113), (15, 20, 25), (15, 36, 39), and (8, 15, 17).
How many different right triangle with integer side lengths exist with a leg equal to 42? How do you know?
BONUS QUESTION:
42 is the product of 3 different prime numbers  2, 3, and 7.
Resolve this problem given a leg which is the product of n different primes, given that, as in this problem, one of these primes is 2.
My answer to the first question: 4, and to the bonus question: (3^{n}3)/6
Every primitive (i.e. pairwise coprime) Pythagorean triple can be expressed as (r²s², 2rs, r²+s²), where r and s are coprime, r is greater than s, and exactly one of them is odd. (See Pythagorean Triples for a demonstration of this)
The first element (a leg of the corresponding triangle) of each primitive Pythagorean triple is odd; the second (another leg) is a multiple of 4; and the hypotenuse is odd. These facts are clear from the fact that exactly one of r and s is odd, and I demonstrate this on the Pythagorean Triples page as well.
Every Pythagorean triple is some positive integer k multiplied by a primitive Pythagorean triple. 42 can't be the middle element (as I've written it here) because 42 isn't a multiple of 4. We're told 42 is a leg, so it must be the first element. The primitive Pythagorean triple from which our answers are derived must be an odd factor of 42, which means it is 3, 7, or 21.
That means r is at most 11, because all larger values of r result in numbers larger than 21 in the first position of the primitive Pythagorean triple. So at this point, I could just look at the 27 different primitive Pythagorean triples generated by values of r ranging from two through eleven, but it would be more instructive to the "bonus question" if I do a bit more actual thinking here.
Every odd number 2k+1 appears as the first element of a primitive Pythagorean triple when s=k and r=k+1, so 3, 7, and 21 all appear as the first element of a primitive Pythagorean triple at least once. But prime numbers appear no more than once.
Why is that? Because rs is a divisor of r²s², so r²s² is not prime unless rs=1 (a necessary but not sufficient condition). The number 21 can appear in the first element of a primitive Pythagorean triple more than once because it isn't prime, and in fact it appears twice, because it can be expressed as the difference of squares in two different ways: 121100 and 254. These correspond to r,s values of 11,10 and 5,2, respectively.
Since the first element of the primitive Pythagorean triple is the difference of two squares r²s², it is also the product of (r+s)(rs). Since 21 is the product of two primes, it can only be factored two ways  21*1 and 7*3, corresponding to the two values of r,s which define the two primitive Pythagorean triples in which 21 appears as the first element.
So whenever a number, m, is the product three distinct primes (of which 2 is one of them), there are exactly four Pythagorean triples containing m as an element.
This, by the way, is the same as the number of Pythagorean triples containing m as an element, where m is the product of two distinct odd primes. The inclusion of the prime number, 2, is a red herring. This is because r and s have opposite parity, so their difference and their sum can't be even, so no primitive Pythagorean triple has 2 as a factor of its first element, and the second element always has two twice as a factor.
I'll explore larger numbers of distinct odd primes in the prime factorization of the first leg.
If m is the product of 3 distinct odd primes, say 3*5*7=105, then the number of triples whose first element is a factor of 105 is:
(r+s)(rs)=some factor of 105
(2+1)(21)=3
(3+2)(32)=5
(4+3)(43)=7
(8+7)(87)=15
(4+1)(41)=15
(11+10)(1110)=21
(5+2)(52)=21
(18+17)(1817)=35
(6+1)(61)=35
(53+52)(5352)=105
(11+4)(114)=105
(13+8)(138)=105
(19+16)(1916)=105
The total is 13 triples containing the product of three odd primes (or four primes including 2), as follows:
3*1 triples for each of the three odd primes, plus
3*2 triples for each of the pairs of odd primes, plus
1*4 triples for each of the odd primes taken 3 at a time.
Well, I have to be honest here, and tell you I haven't found 13 primitive Pythagorean triples yet, just 13 different pairs of factors r+s and rs whose products are factors of 105. To verify these correspond to primitive Pythagorean triples, I must also show that r is greater than s, they have opposite parity and are coprime. These are fairly easy, so I'll just rattle them off here:
1. r and s are different, and I'll just stipulate that r is the bigger of the two.
2. The product of r+s and rs is odd, so r+s is odd, which means they have opposite parity.
3. The product of r+s and rs is the product of distinct primes, so r+s and rs have no prime factor in common.
That is, GCD(r+s,rs)=1
By linear combination GCD(2r,rs)=1, so GCD(r,rs)=1, so GCD(r,s)=1
("Linear combination" means this: GCD(a,b)=GCD(a+kb,b), where k is any integer.)
This is _{3}C_{1} ways to pick one of the primes times 1, which is half the number of factors of this one prime, plus
_{3}C_{2} ways to pick two of the primes times 2, which is half the number of factors of the product of two primes, plus
_{3}C_{3} ways to pick three primes times 4, which is half the number of factors of the product of three primes.
I expect you'll see right away where the _{3}C_{i} comes from (the number of ways to pick i primes from among three possibilities), but you may wonder about the "half the number of factors" piece of it. This comes from the fact that the number of ways to factor of the product of n distinct primes is (or any nonsquare, for that matter) is half the number of factors of that number, and the number of factors of the product of n primes is 2^{n}. (In general, the number of factors of p_{1}^{e}1 * p_{2}^{e}2 * ... * p_{n}^{e}n is (e_{1}+1)(e_{2}+1)...(e_{n}+1) )
If n is the number of odd primes, then the number of triples is
_{ }
∑ _{n}C_{i} 2^{i1}
^{i=1}
The following table gives, for various numbers of odd primes, the number of Pythagorean triples with an element that can be expressed as the product of this many odd primes:
n triples 1 1 2 4 3 13 4 40 5 121 6 364 7 1093
A little clever deduction  see below  (or a peak at Sloan's integer sequences  hey, it's a free country!) will convince you that this sequence is
(3^{n}1)/2
Since the bonus question was phrased so as to include 2 as one of the n primes (and 2 is a red herring, as described above), the answer to the bonus question becomes
(3^{n1}1)/2, or
(3^{n}3)/6,
which is my answer to the bonus question.
It turns out that was the hard way to solve this problem. Here's the easy way, by Sasha:
The problem: how many pairs of integers (j , k) with k > j exist such that 42² + j² = k²?
42² = k²  j² = (k + j)(k  j)
Since k and j are integers and k > j, k + j and k  j must be positive integers which, when multiplied, equal 42². This seems straightforward  find the number of factors of 42², subtract 1 (since we can't have j = 0), and divide by two.
42 = (2)(3)(7)
42² = 2²3²7²
So 42 has (2+1)³ = 27 factors, and 13 factor pairs.
However, not all factor pairs will give us integer values of j and k. Allow the two factors to be F_{1} and F_{2} so that F_{2} > F_{1} and F_{1}F_{2} = 42²
k + j = F_{2}
k  j = F_{1}
k = (F_{2}+F_{1})/2
j = (F_{2}F_{1})/2
We can therefore allow both factors to be odd or both factors to be even, but if they were both odd, their product would be odd, so both factors must be even. This means we must eliminate all cases where F_{1} OR F_{2} = 4k, where k is any factor of 3²7². There are 9 such factors, so only 4 right triangles with integer side lengths and a leg equal to 42 exist. In general, we eliminate 3^{n1} factor pairs. This leads us to our general equation for the bonus question
^{1}/_{2}(3^{n}  1)  ^{1}/_{3}3^{n} = ^{1}/_{6}(3^{n}3)
Incidentally, this proves that there are no right triangles with integer side lengths and a leg equal to 2 (that is, for n = 1, ^{1}/_{6}(3^{n}  3) = 0 ).
I realized that the number of triangles with a leg that is the product of n primes (of which 2 is one) is equal to the number of triangles with a leg that is the product of n1 odd primes.
Using that fact, and Sasha's basic method, we have this solution:
The problem: how many pairs of integers (j , k) with k > j > 0 exist such that 42² + j² = k²? This is the same as the number of pairs of integers (j, k) with k > j > 0 such that 21² + j² = k²?
21² = k²  j² = (k + j)(k  j)
Since k and j are integers and k > j, k + j and k  j must be positive integers which, when multiplied, equal 21². This seems straightforward  find the number of factors of 42², subtract 1 (since we can't have j = 0), and divide by two.
21 = (3)(7)
21² = 3²7²
So 21 has (1+1)³ = 9 factors, and 4 factor pairs.
This leads us to our general equation for the bonus question
^{1}/_{2}(3^{n1}  1) = ^{1}/_{6}(3^{n}3)
_{ n}
∑ _{n}C_{i} 2^{i1} =
(3^{n}1)/2
^{i=1}
First, let me restate it as
_{ n }
∑ _{n}C_{i} 2^{i} = 3^{n}
^{i=0}
This proof will use the same idea as the "Pascal's Triangle" proof that the sum of any row of Pascal's Triangle is twice the sum of the row above it, because in forming the sum, each element of the higher row is used twice as an addend in forming the row below it.
In this case, you can think of the sum, immediately above, as a kind of Pascal's Triangle in which each element is formed from twice the element aboveandtotheleft plus the element aboveandtotheright. Thus, each element of the higher row is used three times as an addend in forming the row below it.
Now let's do it with a bit more rigor. This will be a proof by induction on n...
It's true when n=0. Let's assume it's true when n=k, and show it's true when n=k+1.
A quick review...
_{k+1}C_{i} = _{k}C_{i1} + _{k}C_{i} , when 0 < i <= k, and
_{k+1}C_{0} = 1, and _{k+1}C_{k+1} = _{k}C_{k}, so
_{k+1}C_{i} 2^{i} = 2_{k}C_{i1} 2^{i1} + _{k}C_{i} 2^{i} , when 0 < i <= k, and
_{k+1}C_{0} 2^{0} = 1, and _{k+1}C_{k+1} 2^{k+1} = 2 _{k}C_{k} 2^{k} , so here we have:
_{k+1} 
_{k} 
_{ k} 2∑ _{k}C_{i1} 2^{i1} + ^{ i=1} 
_{ k} ∑ _{k}C_{i} 2^{i} + 2 _{ k}C_{k} 2^{k} ^{ i=1} 
Then, by rearranging the right hand side of this equation (the "1" becomes part of the second sum, and the "2 _{k}C_{k} 2^{k}" becomes part of the first):
_{k+1} 
_{ k} 2∑ _{k}C_{i} 2^{i} + ^{ i=0} 
_{ k} ∑ _{k}C_{i} 2^{i} = ^{ i=0} 
_{ k} 3∑ _{k}C_{i} 2^{i} = ^{ i=0} 
3^{k+1} 
Prove that the area of a right triangle with integer sides is not a perfect square. I got some help, and finished this proof!
Formulas for Primitive Pythagorean Triples and their deriviation  a way to generate all the triples such that a² + b² = c²
Arithmetic Sequence of Perfect Squares, page 3  If a², b², c² are in arithmetic sequence, why is their constant difference a multiple of 24? Look at the second answer to this question for the relationship between Pythagorean Triples and this arithmetic sequence of squares.
Basic Number Theory Definitions
Theorems Involving Perfect Squares  answers questions such as "why is the square root of x irrational unless x is a perfect square?" and other fundamental questions about perfect squares.
The webmaster and author of this Math Help site is Graeme McRae.