Pythagorean triples
List every primitive Pythagorean triple up to the hypotenuse you choose: up to 25 there are four, 3-4-5, 5-12-13, 8-15-17 and 7-24-25, each with the legs in increasing order. Multiples such as 6-8-10 are left out. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Max hypotenuse
- 25
- Quantity
- 4
A primitive Pythagorean triple is three positive integers a, b, and c that satisfy a squared plus b squared equals c squared and share no common factor greater than one. The familiar 3-4-5 triangle is the smallest; 5-12-13 and 8-15-17 follow. This generator accepts a maximum hypotenuse and returns every primitive triple whose hypotenuse is at most that bound, each written as an ordered array [a, b, c] with a less than b less than c. The engine uses Euclid’s formula with coprime, opposite-parity parameters so each primitive appears exactly once and non-primitive multiples such as 6-8-10 are excluded. Students, contest authors, and geometry pipelines use the list to seed problems, check integer right triangles, and avoid floating-point sides.
What a primitive Pythagorean triple is and how Euclid’s formula lists them
A Pythagorean triple is a triple of positive integers a, b, and c that satisfy the right-triangle relation a squared plus b squared equals c squared. The triple is primitive when a, b, and c share no common divisor greater than one, so 3, 4, 5 is primitive while 6, 8, 10 is not, because those sides are a common multiple of 3, 4, 5.
Euclid’s formula produces every primitive triple exactly once: choose integers m greater than n greater than zero, require that m and n are coprime, and require that they have opposite parity, meaning one even and one odd. Then the legs and hypotenuse are a equals m squared minus n squared, b equals two m n, and c equals m squared plus n squared.
This generator keeps only those triples whose hypotenuse is less than or equal to the maximum you supply, and it always returns the legs in increasing order so each row is the smaller leg, the larger leg, and the hypotenuse. Nothing is sampled at random and nothing is looked up from a table: every pair m, n inside the bound is examined with integer arithmetic only.
Multiples k times a, b, c with k greater than one are excluded on purpose; if you need scaled families you can multiply a primitive triple after you receive it.
Where a primitive-triples generator earns its keep
Teachers and contest authors use a primitive Pythagorean triples generator to build problem banks of integer-sided right triangles that are not obvious multiples of 3-4-5. Geometry and computer-aided design notebooks need a compact list of primitive directions on the integer lattice so they can construct exact orthogonal corners without floating-point drift. Programming-challenge authors need a deterministic oracle that lists every primitive with hypotenuse at most N so hidden tests cannot disagree with a student’s nested loops.
Number-theory lessons introduce Euclid’s formula and then ask students to list primitives up to fifty or one hundred; this page is the answer key and the live demonstration in one place. Invalid maxima do not consume balance. Keep the maximum modest when you only need classroom examples, pin the returned arrays in tests, and you get a reproducible catalog of primitive triples without standing up a computer-algebra system or copying sequence tables by hand.
If you need the hypotenuse of a single triangle, a missing-leg solver, or a yes-or-no right-triangle check, use those dedicated tools: this landing answers only the enumerate-primitives-up-to-c question.
What you can do with it
Classroom answer keys and worksheets
List every primitive integer right triangle with hypotenuse at most 25, 50, or 100 so students can check Euclid-formula exercises without copying a printed table.
Exact lattice geometry
Seed CAD, game, or graphics code with primitive (a, b, c) directions so orthogonal corners stay on the integer lattice instead of drifting under floating-point square roots.
FAQ
What is a primitive Pythagorean triple?
Three positive integers a, b, and c with a² + b² = c² and gcd(a, b, c) = 1. The smallest is 3, 4, 5. Multiples such as 6, 8, 10 are Pythagorean but not primitive.
How does the generator find every primitive triple?
Only triples with c at most your maximum are returned, each as [a, b, c] with a < b.
Why is 6, 8, 10 missing from the list?
Because it is 2 × (3, 4, 5). This tool lists primitives only. Multiply a returned triple by any positive integer k if you need the scaled family.
What happens if the maximum hypotenuse is less than 5?
You get an empty list, not an error. The smallest primitive triple is 3-4-5, so no hypotenuse below 5 can belong to one. Any positive whole number is still accepted as the limit.
What is the largest hypotenuse I can ask for?
Up to ten thousand. Within that bound every possible combination is checked with whole-number arithmetic, so the list is complete and nothing depends on chance or on a stored table.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/math/pythagorean-triples \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"max_hypotenuse":25}'const res = await fetch("https://api.kit.forhosting.com/math/pythagorean-triples", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"max_hypotenuse": 25
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/math/pythagorean-triples",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"max_hypotenuse": 25
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/math/pythagorean-triples", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"max_hypotenuse":25}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"max_hypotenuse":25}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/math/pythagorean-triples", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"max_hypotenuse": 25
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "math.pythagorean_triples",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
max_hypotenuse | 10000 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
If the maximum is not a positive integer the task fails with invalid_input and is not billed; a successful call costs $0.002.
Input contract, response shape, and how invalid maxima fail
When the maximum is a valid integer smaller than five, the result is a success with an empty triples array, because the smallest primitive hypotenuse is five, the 3-4-5 triangle. Failed validation is not billed. Pair it with a right-triangle checker if you need the converse question, and pin the returned arrays in tests so a later change to sorting or filtering cannot slip past unnoticed. Send a JSON object with the required field max_hypotenuse, a positive integer that is the largest hypotenuse you want to allow. The aliases max, hypotenuse, c_max, and limit are accepted so forms, query strings, and scripts can reuse the same contract. The value may arrive as a JSON integer or as a decimal digit string; a leading plus sign is allowed, but fractions, scientific notation, zeros, negatives, empty strings, and non-numeric text are rejected with invalid_input that names the field. There is a published ceiling of ten thousand on the maximum hypotenuse so the free browser path and the edge Worker stay inside a predictable time and memory budget: the search is quadratic in the square root of that ceiling. The success body echoes max_hypotenuse, reports count, and lists triples as arrays of three integers. Do not send a floating hypotenuse such as twenty-five point five and do not send a list of sides to be checked: this endpoint enumerates primitives, it does not test whether three given numbers already form a right triangle.
Integration use cases
Contest oracles and unit tests
Generate a deterministic catalog of primitive triples for hidden tests, property checks, and programming-challenge fixtures that must not drift between judges.
Technical questions
What happens if the maximum hypotenuse is 1, 2, 3, or 4?
The call succeeds and returns count 0 with an empty triples array. The smallest primitive hypotenuse is 5. A non-positive or non-integer maximum fails with invalid_input instead.
What does the primitive Pythagorean triples generator cost?
The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.