Perfect Right-angled Triangles
A right-angled triangle with sides a, b, and hypotenuse c is called perfect if: 1. (a, b, c) is a primitive Pythagorean triple. 2. The hypotenuse c is a perfect square. How many perfect right-angle...
Problem Statement
This archive keeps the full statement, math, and original media on the page.
Consider the right angled triangle with sides \(a=7\), \(b=24\) and \(c=25\). The area of this triangle is \(84\), which is divisible by the perfect numbers \(6\) and \(28\).
Moreover it is a primitive right angled triangle as \(\gcd (a,b)=1\) and \(\gcd (b,c)=1\).
Also \(c\) is a perfect square.
We will call a right angled triangle perfect if
-
it is a primitive right angled triangle
-
its hypotenuse is a perfect square.
We will call a right angled triangle super-perfect if
-
it is a perfect right angled triangle and
-
its area is a multiple of the perfect numbers \(6\) and \(28\).
How many perfect right-angled triangles with \(c \le 10^{16}\) exist that are not super-perfect?
Problem 218: Perfect Right-angled Triangles
Mathematical Development
Theorem 1 (Parametrization of primitive Pythagorean triples). Every primitive Pythagorean triple with even is given by
where , , and .
Proof. This is the classical Euclid parametrization.
Lemma 1 (Area formula). The area is
Proof. Since ,
Theorem 2 (Every perfect triangle has area divisible by 84). For every perfect right-angled triangle,
In particular, its area is divisible by both 6 and 28.
Proof. Since the hypotenuse is a perfect square, say
the triple is itself a primitive Pythagorean triple. Hence one may write
or the symmetric variant.
- Factor 3: if neither nor were divisible by 3, then impossible for a square. So .
- Factor 4: the even parameter is , and one of is even, so in fact divides that factor.
- Factor 7: substituting the second parametrization and checking residues modulo 7 shows that one of is always divisible by 7.
Therefore divides
Editorial
There is no search left once the second parametrization is used. A perfect triangle already starts as a primitive Pythagorean triple, and the extra condition that the hypotenuse is a square forces the parameters to form another primitive Pythagorean triple. That second layer is what injects the extra divisibility.
From the resulting area formula
the factors 3 and 4 are immediate, and a short residue check supplies the factor 7. So every perfect triangle has area divisible by 84, which means no triangle can fail both the divisibility-by-6 and divisibility-by-28 requirements.
Pseudocode
Use the primitive Pythagorean parametrization for (a, b, c).
Use the condition c = square to parametrize (m, n, k) as another primitive triple.
Deduce from the area formula that every candidate area has factors 3, 4, and 7.
Since every perfect triangle has area divisible by 84, the number of exceptions is 0.
Return 0.
Complexity Analysis
- Time: .
- Space: .
Answer
Code
Each problem page includes the exact C++ and Python source files from the local archive.
#include <bits/stdc++.h>
using namespace std;
long long countNonSuperPerfect(long long /*limit*/) {
// The proof shows every perfect right-angled triangle has area divisible by 84,
// so none can fail both the divisibility-by-6 and divisibility-by-28 tests.
return 0;
}
int main() {
cout << countNonSuperPerfect(10000000000000000LL) << '\n';
return 0;
}
"""
Problem 218: Perfect Right-angled Triangles
Every perfect right-angled triangle has area divisible by 84.
Therefore no perfect triangle can fail both the divisibility-by-6
and divisibility-by-28 tests.
"""
def count_non_super_perfect(limit):
# The proof is independent of the hypotenuse bound.
return 0
def solve():
print(count_non_super_perfect(10**16))
if __name__ == "__main__":
solve()