Project Euler Lab - Problem 75

#75 - Singular Integer Right Triangles

● FoundationOfficial difficulty: 10%PointsTier A - full browser executionNot viewed
↖ Euler Lab

It turns out that \(\pu{12 cm}\) is the smallest length of wire that can be bent to form an integer sided right angle triangle in exactly one way, but there are many more examples.

  • \(\pu{\mathbf{12} \mathbf{cm}}\): \((3,4,5)\)
  • \(\pu{\mathbf{24} \mathbf{cm}}\): \((6,8,10)\)
  • \(\pu{\mathbf{30} \mathbf{cm}}\): \((5,12,13)\)
  • \(\pu{\mathbf{36} \mathbf{cm}}\): \((9,12,15)\)
  • \(\pu{\mathbf{40} \mathbf{cm}}\): \((8,15,17)\)
  • \(\pu{\mathbf{48} \mathbf{cm}}\): \((12,16,20)\)

In contrast, some lengths of wire, like \(\pu{20 cm}\), cannot be bent to form an integer sided right angle triangle, and other lengths allow more than one solution to be found; for example, using \(\pu{120 cm}\) it is possible to form exactly three different integer sided right angle triangles.

  • \(\pu{\mathbf{120} \mathbf{cm}}\): \((30,40,50)\), \((20,48,52)\), \((24,45,51)\)

Given that \(L\) is the length of the wire, for how many values of \(L \le 1\,500\,000\) can exactly one integer sided right angle triangle be formed?

This problem is taken from Project Euler, Problem 75.
Problem text © Project Euler, licensed under CC BY-NC-SA 4.0. Original: projecteuler.net/problem=75. Published Friday, 30th July 2004, 06:00 pm. Solved by 20,929 members at time of mirroring.

Why this is useful

General Problem Solving. Builds computational thinking, decomposition, and debugging discipline - transferable, without a specific financial application.

We classify relevance honestly - not every Euler problem is a trading application.

Prerequisites

Lessons that prepare you:
19.5 Combinatorics: Counting, Binomials, and Inclusion–Exclusion · 19.10 Search: Backtracking, Branch-and-Bound, Binary Search, Meet-in-the-Middle · 3.1 Vectors, Multivariable Functions, and Level Sets

Recommended stepping-stone problems: #9 · #28 · #39

Concepts: geometry

Likely techniques: inclusion-exclusion

Learning mode

Pick how much scaffolding you want. Your choice is remembered per problem.

Scratchpad

Mathematical notes, formulas, pseudocode, hypotheses, complexity notes. Saved automatically with your progress.

Python workbench

Tier A - full browser execution
Runs at full original scale within the browser limits.

Real Python (Pyodide) in a sandboxed Web Worker - no network, no filesystem, no DOM access. Ctrl/Cmd+Enter runs. Escape leaves the editor. Stop terminates the worker.

Python runtime not loaded (it boots on first run - a one-time local load).

Check your answer

Answers are checked against a salted hash held in a separate file - not printed in this page. This prevents accidental spoilers; it is not cryptographic protection (see the build notes).

Progressive hints

Confidence

Low confidence schedules this problem for spaced review, even if you solved it.

Reference solution

Spoiler
The complete original explanation (interpretation, naive approach, insight, proof, complexity, Python implementation, tests, common mistakes, alternatives) is hidden and lazy-loaded. Reveal it only after a meaningful attempt - the struggle is where the learning happens.