← the late compiler
C_000196 · mathematical foundations · intermediate

Integer Partitions

The ways of writing an integer as a sum of positive integers, ignoring order — a classic counting problem with surprisingly deep structure.

Step 1 of 4

In words

What it is, why it matters, and what it is like.

Why am I learning this?

Counting how many ways to split a number into positive parts (like 5 = 3+2) becomes the foundation for understanding recurrence, recursion, and generating functions—tools that later explain how algorithms explore search spaces and how combinatorial structures like trees and Catalan Numbers are counted. You will see this in computer science when you calculate the number of possible states in a search, or in AI when you analyse the complexity of backtracking algorithms that find solutions step-by-step (like path planning or constraint satisfaction).

The idea, in plain terms

Imagine you have a big pile of identical coins and you want to distribute them into a row of dishes. Each dish must get at least one coin, and you don't care about the order of the dishes—just how many coins go in each. The question 'how many different distributions are there for, say, 7 coins?' is exactly the integer partition problem. For example, with 4 coins, you could put them all in one dish (4), split into two dishes (1+3 or 2+2), or three dishes (1+1+2), or four (1+1+1+1). These are the partitions of 4. The count grows surprisingly fast: while 4 has just 5 partitions, 10 has 42, and 20 has 627. There is no simple formula like 'n squared' to jump straight to the answer; instead, you build it up by thinking about how to add one more to the pile.

An analogy

Think of stacking boxes of different heights on a shelf, where you only have a fixed total height. Each arrangement that uses the exact total height is a partition of that height (for example, height 3 could be one box of height 3, or a 2 and a 1, or three 1s—order doesn't matter). The catch: you can reuse the same box height as many times as you like, but swapping the order of boxes doesn't count as a new arrangement. This is like having an unlimited supply of weights in a gym and trying to reach a target weight on the bar—you could use two 10s or four 5s, but putting the 10s in a different order doesn't change the load. The analogy breaks down when you consider that in partitions, the 'boxes' are just numbers, and there is no physical limit on how many times you can use each number—so the count can get huge. Also, unlike real shelves, you cannot leave any gap—the sum must equal exactly the target.

Definition

An integer partition of a positive integer n is a way of writing n as a sum of positive integers, where the order of the addends does not matter, and where repetition is allowed.

Where this sits

You already have notes on Catalan Numbers, Modular Arithmetic, and Proof by Induction. Integer partitions connect to these: they are a classic example of a combinatorial count (like Catalan Numbers) where a recursive recurrence leads to a fast algorithm. They also relate to modular arithmetic when we study the divisibility patterns of partition counts (like Ramanujan's congruences)—though that is advanced. Most importantly, the recursive way to compute partitions mirrors inductive proofs: you split the problem into smaller subproblems and combine results. This is the same pattern you will see in recursive algorithms for tree traversal and backtracking, which your notes list under 'Recursive Thinking'.

Signal from the Frontier

Get the next essay on mind, machine, and meaning

Essays at the intersection of AI, philosophy, and Indian governance. No promotional content.

We'll send a one-click sign-in link to confirm. No password needed.

Views expressed are personal and do not represent the Government of India or the Government of Uttarakhand.