Skip to main content
Calcimator

Integer Partition Calculator

Count the number of integer partitions of n with optional constraints on maximum part size and distinctness.

About this calculator

This calculator counts integer partitions — the number of ways to write a whole number n as a sum of positive integers, ignoring order — under an optional cap on the largest allowed part and an optional restriction to distinct parts only, using a dynamic-programming table rather than brute-force enumeration. The Integer n dominates the Partition Count by a wide margin over Max Part Size, since growing n by a given percentage multiplies the number of achievable sums combinatorially, while nudging Max Part Size only ever removes or restores the single largest-part partition at the boundary it's set to.

The Unrestricted p(n) readout is the more surprising of the two outputs: it always reports the fully unconstrained partition count for n, completely ignoring both your Max Part Size and your Distinct Parts Only settings — the code that computes it recomputes partitions of n with the cap reset back to n itself and distinctness turned off, regardless of what you selected for the main Partition Count above it. So lowering Max Part Size or checking Distinct Parts Only changes Partition Count but leaves Unrestricted p(n) exactly where it started, which is by design — it exists purely as an unconstrained baseline for comparison, not a second measurement of your specific constraints.

Inputs

Results

Partition Count

42

Unrestricted p(n)42
How to Use This Calculator
  1. Enter the Integer n to compute its number of integer partitions.
  2. Optionally set a Max Part Size to restrict the partition to parts at most that value.
  3. Toggle Distinct Parts Only to count partitions where all parts must be different.
  4. Review Partition Count under your constraints and the unrestricted p(n) for comparison.
  5. Use the Conjugate Count to explore partition duality in combinatorics problems.

How the result changes with Integer n

Integer nPartition Count
57
7.522
15164
251,455

What each input means

Integer n
The integer to partition (max 200)
Max Part Size
Largest allowed part in the partition (set equal to n for unrestricted)
Distinct Parts Only (0=No, 1=Yes)
Restrict to partitions where all parts are distinct

How this is calculated

Worked example, using the default values

  1. Identify Input Parameters
    Integer n = 10, Max Part Size = 10, Distinct Parts Only (0=No, 1=Yes) = 0 = 3 input(s) provided
  2. Calculate Partition Count
    Partition Count
    42 = 42
  3. Calculate Unrestricted p
    Unrestricted p
    42 = 42

Engine last updated . Checked against 6 independently-derived tests — how we verify calculators. Built by Paul Gunder, a software engineer, not a licensed financial, medical, or legal professional.

Frequently Asked Questions

Why doesn't Unrestricted p(n) change when I lower Max Part Size?

Unrestricted p(n) is deliberately computed with the part-size cap reset to n itself and distinctness switched off every time, regardless of whatever Max Part Size or Distinct Parts Only you've set for the main Partition Count. It exists to show the baseline count with no constraints at all, so your constraint settings never reach that particular calculation.

Why does Integer n move the result so much more than Max Part Size does?

Growing n opens up an entire new range of achievable sums and combinations, so the partition count grows combinatorially with it. Max Part Size, by contrast, only ever affects whether partitions using a part right at (or above) that cap are counted or excluded, a much narrower slice of the total than n's effect on the whole combinatorial space.

What does checking Distinct Parts Only actually restrict?

With it off, the calculator allows any part size to repeat as many times as needed to reach the sum — so 4 could be written as 2 + 2. With it checked, every part in a counted partition must be a different value from every other part in that same partition, which rules out sums like 2 + 2 and generally produces a smaller partition count for the same n.

How does Max Part Size = n differ from leaving it unset?

Setting Max Part Size equal to n places no real restriction at all, since no single part in a partition of n can ever exceed n itself anyway — every partition remains eligible. That's exactly the setting the calculator falls back to automatically whenever Max Part Size is left at its default, which is why the default Partition Count and Unrestricted p(n) typically agree.

The questions that sit next to this one — chosen by subject, including calculators filed under a different category.

More in Math & Statistics.