ForHosting KIT · Math

Prime triplet finder

Lists every prime triplet up to your limit in the two shapes p, p + 2, p + 6 and p, p + 4, p + 6: up to 50 there are 7, from (5, 7, 11) to (41, 43, 47). Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
N
50
You get
Quantity
7
Patterns
p,p+2,p+6, p,p+4,p+6

A prime triplet is a tight cluster of three primes that sit on a fixed pattern of gaps. The two constellations this tool lists are (p, p + 2, p + 6) and (p, p + 4, p + 6): every member is prime, the diameter of the cluster is six, and the first examples everyone learns—(5, 7, 11), (7, 11, 13), (11, 13, 17), (13, 17, 19)—appear within the first few dozen integers. Given an upper bound n of at least seven, the finder sieves primes through n and returns every qualifying triplet whose largest member is at most n, with a stable pattern label on each hit.

What a prime triplet is and which patterns this tool lists

In elementary number theory a prime triplet (sometimes called a prime constellation of length three) is three primes that match a fixed admissible gap pattern. Not every triple of gaps is admissible: among any three consecutive odd integers one is divisible by three, so the pattern (0, 2, 4) only works for the exceptional set involving the prime three, and this capability deliberately excludes that one-off case. The two patterns that survive for arbitrarily large candidates—subject to open conjectures about infinitude—are (0, 2, 6) and (0, 4, 6).

Written out they are the ordered triples (p, p + 2, p + 6) and (p, p + 4, p + 6). Classic small examples of the first pattern include (5, 7, 11), (11, 13, 17), (17, 19, 23), and (41, 43, 47). Classic examples of the second include (7, 11, 13), (13, 17, 19), (37, 41, 43), and (67, 71, 73).

This capability takes a single integer n, builds a Sieve of Eratosthenes up to n, and walks every candidate lower member p such that p + 6 is still at most n. Whenever p, p + 2, and p + 6 are all unmarked as composite it records a triplet with pattern tag p,p+2,p+6; whenever p, p + 4, and p + 6 are all prime it records pattern p,p+4,p+6.

Where prime-triplet tables show up in real work

Contest programmers and olympiad coaches use triplet tables as the natural next step after twin primes: students learn that admissible patterns matter, that the diameter-six constellations are the ones that keep recurring, and that a deterministic oracle beats a hand-written list that someone forgot to update. Because the capability is a pure parse engine, the same n always yields the same reply with no network dependency and no stored state.

If you later need twin pairs only, the prime-counting function π(n), factorization, or a next-prime probe, treat those as separate search intents rather than overloading this triplet-focused landing. Prime triplets stay the right page when the question is which diameter-six constellations of form (p, p + 2, p + 6) or (p, p + 4, p + 6) appear up to a chosen bound.

Homework and olympiad warm-ups

List classroom prime triplets up to a bound and classify each hit as (p,p+2,p+6) or (p,p+4,p+6) for sieve worksheets and contest practice.

What prime triplet patterns does this tool find?

It lists (p, p+2, p+6) and (p, p+4, p+6) with every member prime and all members ≤ n. Each hit is tagged with pattern p,p+2,p+6 or p,p+4,p+6.

Why must n be at least 7?

Both patterns span six integers from p to p+6.

Is (3, 5, 7) included?

No. That triple is the exceptional (p, p+2, p+4) pattern, which is not one of the two diameter-six constellations this landing targets.

Is the result deterministic?

There is no randomness, network call, or model—only a sieve and a linear scan.

What does it cost?

The browser tool is free and runs locally.

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.

POSThttps://api.kit.forhosting.com/numth/prime-triplet

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.

curl -X POST https://api.kit.forhosting.com/numth/prime-triplet \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"n":50}'
{
  "n": 50
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "numth.prime_triplet",
  "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.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

min_n7
max_n1000000
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

What a prime triplet is and which patterns this tool lists

Because both patterns share the same diameter of six, the natural lower bound on n is seven: below that no constellation of span six can fit, and the API rejects those inputs with invalid_input rather than silently returning an empty array that looks like a successful search over a too-small window.

Input contract, successful replies, and deterministic sieving

Decimals, empty fields, non-numeric strings, and values below seven fail validation and are not charged. Spot checks you can trust without a textbook open: n equals fifty returns the familiar classroom list including (5, 7, 11), (7, 11, 13), (11, 13, 17), (13, 17, 19), (17, 19, 23), (37, 41, 43), and (41, 43, 47); n equals eleven returns only (5, 7, 11); n equals seven is valid input and correctly returns count zero because the first real hit needs eleven. Send a required integer field n (aliases number, value, and limit are accepted). The value must be an integer at least seven and at most one million so the sieve stays within Worker and browser memory budgets. On success the JSON includes the echoed n, count equal to the number of triplets found, a triplets array of objects each carrying p, members as a three-element array, and pattern as one of the two labels, plus a patterns array that documents the search space for clients that want to render a legend without hard-coding strings. The sieve marks composites once with a Uint8Array, then a single linear scan collects hits—no randomness, no Date stamps, and no external primality service—so the same n always yields the same JSON. API pricing is the published base of $0.002 per successful item; failed validation does not consume balance.

Deterministic fixtures for number-theory demos

Generate stable triplet tables for teaching slides, unit tests, and documentation examples without hand-maintaining JSON.

Pipeline-friendly constellation checks

Call the same isomorphic contract from scripts and CI so prime-triplet assertions never depend on a casual web form or a model.

Read the full KIT documentation →