Prime quadruplet finder
The prime quadruplet finder lists every tightly packed four-prime pattern of the form p, p plus two, p plus six, and p plus eight whose members do not exceed your chosen limit.
Run — free
Enter an integer of at least thirteen and receive an ordered collection of quadruplets together with a count. The calculation uses a deterministic sieve, so repeated requests with the same limit produce exactly the same result. It is useful for exploring prime constellations, checking examples, preparing exercises, and generating dependable test data without manually testing each candidate.
What the finder includes in its results
A prime quadruplet in this tool has one precise shape: four prime numbers written as p, p plus two, p plus six, and p plus eight. The limit n is inclusive and applies to the complete pattern. In other words, a quadruplet is returned only when its largest member, p plus eight, is less than or equal to n. This interpretation makes boundary behavior predictable: a pattern does not appear early merely because its first prime is within the limit. The first valid result is 5, 7, 11, 13, which is why the smallest accepted input is thirteen. Output is sorted by the first prime because candidates are examined in ascending order. Each result is represented as a four-number array, and the count field tells you how many arrays were found. The tool does not list arbitrary groups of four primes, near matches, or arrangements with different gaps; every returned row follows the exact offsets zero, two, six, and eight.
How the calculation works
The calculator first validates that n is a whole number within the published range. It then builds a Sieve of Eratosthenes from zero through n. The sieve marks composite numbers by starting with each unmarked prime and crossing out its multiples, beginning at the square of that prime. After this bounded pass, primality checks are direct lookups rather than repeated trial divisions. The algorithm scans possible starting values p only while p plus eight remains inside the requested limit. For each candidate it checks the four required positions and adds the pattern only when all four are prime. This approach is deterministic: it uses no network service, randomness, current time, stored state, or probabilistic primality test. Consequently, the same valid input always gives the same ordered JSON output. The fixed maximum protects the browser and API worker from unbounded memory and execution time while still allowing substantial lists for experimentation, demonstrations, and automated verification.
Using and interpreting the output
Choose n according to the largest number you want included, not merely the largest starting prime you want tested. For example, if a candidate begins at p, it can appear only when n reaches p plus eight. Read the quadruplets field as an ascending list of independent patterns; each nested array contains exactly four integers. The count is the length of that list and is convenient when a script needs a summary without recounting rows. A valid search may return an empty list when no complete pattern lies inside its range, although the minimum accepted boundary already contains the first known pattern. Use the result directly in lessons about prime gaps, in regression fixtures for mathematical software, or as input to a separate statistical analysis. Remember that the finder enumerates a specific constellation and does not prove broader conjectures about whether infinitely many such patterns exist. API automation costs $0.002 per request, while the same pure calculation can run through the page’s browser experience.
What you can do with it
Explore prime constellations
Generate exact examples of the gap pattern 2, 4, 2 and compare how its occurrences spread across a chosen interval.
Prepare mathematics exercises
Create an ordered answer set for lessons on primality, sieves, prime gaps, and tightly clustered primes.
Build deterministic test fixtures
Supply stable quadruplet lists and counts for testing number-theory software without external data or probabilistic results.
FAQ
What is a prime quadruplet here?
It is exactly four primes of the form p, p+2, p+6, and p+8. Other four-prime gap patterns are not included.
Is n inclusive?
Yes. Every member of a returned quadruplet is at most n, including its largest member p+8.
Why must n be at least 13?
The first prime quadruplet is 5, 7, 11, 13, so thirteen is the smallest useful inclusive upper bound. Inputs below thirteen are rejected.
How are primes found?
The calculator uses a deterministic Sieve of Eratosthenes through n and then checks the four required offsets for each possible start.
What does an API request cost?
Each API request costs $0.002. The browser experience can run the same deterministic calculation locally.
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/numth/prime-quadruplet \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"n":100}'const res = await fetch("https://api.kit.forhosting.com/numth/prime-quadruplet", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"n": 100
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/numth/prime-quadruplet",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"n": 100
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/numth/prime-quadruplet", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"n":100}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"n":100}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/numth/prime-quadruplet", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"n": 100
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "numth.prime_quadruplet",
"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
min_n | 13 |
max_n | 10000000 |
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. |