ForHosting KIT · Math

Odd parts partition count

Count the ways to write a number as a sum of odd parts: 10 has 10 such partitions, and by Euler's theorem that is also how many ways it splits into distinct parts. Exact for any value from 0 to 5000. 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
Quantity
10

This odd-parts partition counter returns the exact number of ways to write a non-negative integer n as a sum of odd positive integers, with order ignored. Euler's partition theorem says that the same number also counts partitions whose parts are all distinct. Enter one integer to obtain an exact decimal result rather than a floating-point approximation. The calculation is deterministic, runs without network access, and treats the empty partition of zero as one valid partition.

What the calculator counts

A partition writes an integer as a sum of positive integers while ignoring the order of the addends. For example, reversing the same addends does not create a new partition. This calculator restricts the first interpretation to odd parts: every addend must be odd, although an odd value may be repeated.

It simultaneously answers a second-looking question, the number of partitions into distinct parts, where no positive integer may appear twice. These two families are equinumerous for every non-negative n, even though their individual members usually look different. The returned count is therefore useful whether your problem is stated with odd summands or with nonrepeating summands.

For n equal to zero, the result is one because the empty sum is the conventional unique partition. The service rejects negative n because ordinary integer partitions in this setting are defined only for non-negative targets.

Why odd parts and distinct parts agree

Euler's theorem can be understood through generating functions or through a direct transformation. In the generating-function view, allowing any number of each odd part produces a product with one geometric factor for every odd integer. Requiring distinct parts produces a product in which each positive integer is either absent or selected once.

Algebraically, the two products have identical coefficients, so the coefficient attached to a chosen n is the same count. A constructive view repeatedly separates powers of two from repeated odd parts and combines equal copies, producing distinct parts without losing the total. The process can be reversed, which establishes a bijection rather than a numerical coincidence.

The implementation counts the distinct-parts side using dynamic programming. It visits each possible part once and updates target sums in descending order. Descending traversal is essential: it prevents a part from being reused during its own pass.

Exact BigInt arithmetic preserves every digit, and the final integer is serialized as a decimal string for reliable transport.

How to use and interpret the result

Provide n as a non-negative integer from zero through the published limit. The response repeats n and supplies count, the exact number of qualifying partitions. You do not need to choose between an odd-parts mode and a distinct-parts mode because Euler's identity guarantees that both requested counts are identical.

This makes the capability convenient for checking combinatorics exercises, validating coefficient tables, testing symbolic generating-function code, or supplying reference values to another deterministic program. Remember that the output counts unordered partitions, not compositions: changing the order of the same terms never creates another result. Repeated values are permitted under the odd-parts interpretation but forbidden under the distinct-parts interpretation; mixing those rules would describe a different problem.

Large answers should remain strings in downstream systems unless their integer type can represent arbitrary precision. Invalid fractions, missing inputs, values over the declared bound, and negative integers return a typed input error instead of a misleading count.

Check combinatorics exercises

Verify exact partition counts when a problem uses odd summands or requires every part to be distinct.

Validate generating functions

Compare computed coefficients with an independent exact count based on Euler's partition identity.

Build reference tables

Generate deterministic decimal counts for tests, teaching material, or integer-sequence research.

Does order matter?

No. Partitions are unordered, so rearranging the same addends does not create another partition.

What happens when n is zero?

The count is one, representing the empty partition.

How many partitions of 10 into odd parts are there?

There are 10. Each one writes 10 as a sum of odd numbers, repeats allowed and order ignored. The same count, 10, is the number of ways to write 10 with parts that never repeat.

Why does one count answer two questions?

Euler's partition theorem says that partitions into odd parts and partitions into distinct parts are equally many for every number. Combining equal copies of a part turns one kind into the other, and the step can be reversed.

What is the largest number I can enter?

Any whole number from 0 to 5000. Negative numbers are refused, and 0 gives 1, because the empty sum counts as its single partition. Large results are shown with every digit.

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/partitions-distinct-odd

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/partitions-distinct-odd \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"n":10}'
{
  "n": 10
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "numth.partitions_distinct_odd",
  "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_n5000
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 the calculator counts

It also returns the count as decimal text so large exact integers are not silently rounded by JSON number limits.

How to use and interpret the result

API automation is charged $0.002 per request, while the calculation itself uses no external data.

What exactly is returned?

The response returns n and the exact count of partitions of n into odd parts, which is also the distinct-parts count.

Why is count a string?

Partition counts can exceed the safe integer range of JSON numbers, so decimal text preserves every digit.

Are negative integers supported?

No. A negative n returns an invalid_input error.

What does an API request cost?

Each API request costs $0.002.

Read the full KIT documentation →