ForHosting KIT · Math

Goldbach partition count

10 splits into two prime pairs, 3 + 7 and 5 + 5, so its Goldbach partition count is 2. Enter any even number from 4 up to ten million to get that count, with each pair counted once. 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
10
You get
Partition count
2

The Goldbach partition count calculator takes an even integer n greater than two and returns how many unordered pairs of prime numbers add exactly to n. For example, ten has two partitions: three plus seven and five plus five. Each pair is counted once, so seven plus three is not treated as a separate answer. The calculation uses an exact sieve of Eratosthenes, requires no network access, and produces the same result every time.

What a Goldbach partition count means

Goldbach's strong conjecture says that every even integer greater than two can be expressed as the sum of two primes. A Goldbach partition is one unordered representation of that kind. For n equal to ten, the valid representations are three plus seven and five plus five, giving a partition count of two.

The order of the addends does not matter: three plus seven and seven plus three describe the same partition and are counted only once. Equal addends are valid when the repeated number is prime, which is why five plus five remains in the count for ten. A zero count would still be a valid successful mathematical result, not an execution error, although finding such a value in the supported range would be highly significant because it would contradict the conjecture.

How the calculator counts pairs exactly once

The algorithm first creates a compact typed array covering every integer from zero through n. It marks zero and one as non-prime, then applies the sieve of Eratosthenes: whenever an unmarked value p is reached before the square root of n, every multiple beginning at p squared is marked composite. After that pass, an unmarked index is prime.

The counter then examines candidate p values only from two through n divided by two. When both p and n minus p are prime, it adds one to the result. Stopping at the halfway point is the detail that makes the partitions unordered.

There is no need to sort pairs, build a set, or divide a duplicated total after scanning. The declared maximum of ten million bounds both the typed-array memory and the loop work, and the implementation enforces that same ceiling instead of relying only on form validation. All arithmetic is exact integer arithmetic within JavaScript's safe range.

Using the count in study, testing, and exploration

A partition count is a useful summary when exploring how prime representations change as even integers grow. Teachers can create answer keys for exercises about primes, sieves, unordered pairs, and Goldbach's conjecture without manually enumerating candidates. Researchers and recreational mathematicians can compare counts at selected inputs or search for local highs and lows within a bounded range, while remembering that computation over a finite range is evidence, not a proof of the conjecture for every integer.

The browser version performs the same pure calculation locally and is free to use interactively. Invalid requests are rejected clearly rather than coerced: an odd n is not silently rounded, a decimal is not truncated, and an oversized value is not attempted. If a project needs the actual prime pairs rather than their number, this capability deliberately does not fabricate that larger output; its contract is optimized for an exact count.

Explore Goldbach counts

Compare the number of unordered prime-sum representations across selected even integers without enumerating pairs by hand.

Check programming exercises

Produce deterministic expected counts for lessons and coding problems about sieves, primes, and unordered pairs.

What is a Goldbach partition?

It is an unordered pair of prime numbers whose sum is the supplied even integer. Reversing the two primes does not create another partition.

Does a repeated prime count?

Yes. If n divided by two is prime, the equal pair is one valid partition; for example, five plus five is a partition of ten.

Why are odd numbers rejected?

This capability implements the strong Goldbach partition question specifically for even integers greater than two, so odd inputs are outside its contract.

Does this calculation prove Goldbach's conjecture?

No. It verifies and counts representations for one supplied integer. Any finite collection of computed cases cannot prove the conjecture for all even integers.

What does it cost?

It is free to run in your browser on this page.

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/goldbach-partition

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/goldbach-partition \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"n":100}'
{
  "n": 100
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "numth.goldbach_partition",
  "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.

max_n10000000
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.

Run it free in your browser for lessons and exploration, or use the API for $0.002 per successful request when a script needs a reproducible count.

What a Goldbach partition count means

This capability returns the input n and a single partition_count value rather than a list of pairs. That compact response is useful when the question is how many representations exist, when comparing counts across many even integers, or when checking a known integer sequence. The input must be an exact JSON integer, must be even, and must fall between four and ten million inclusive. Odd numbers and values below four fail with invalid_input because the requested Goldbach partition definition does not apply to them.

How the calculator counts pairs exactly once

Any pair with distinct addends has exactly one smaller member in that interval, while a pair of equal primes appears exactly at the endpoint. The function does not consult a prime table, call a service, use randomness, read the clock, or preserve state between requests, so identical inputs always produce identical JSON output suitable for automated tests and stable cached results.

Using the count in study, testing, and exploration

Students can calculate consecutive even values and graph partition_count to see that the sequence is irregular even though every tested value still has at least one representation. The API costs $0.002 for each successful request and returns a small object that is easy to store, compare, or feed into a charting pipeline.

Build number-theory fixtures

Use exact compact results in unit tests for independent Goldbach partition implementations and prime tables.

What is the largest supported input?

The maximum n is 10000000. The bound keeps memory and execution time predictable in both the browser and the edge Worker.

Read the full KIT documentation →