Pigeonhole Principle Calculator screenshot

Pigeonhole Principle Calculator

Compute the guaranteed maximum number of items in one hole, the even spread that reaches it, and how many items force a given count.

Privacy First
0 Runs
Updated 2026-11-22
Runs in your browser
No sign-up, no upload
Exact integer arithmetic

Pigeonhole Principle Calculator

Compute the guaranteed maximum number of items in one hole, the even spread that reaches it, and how many items force a given count.

How this page computes

The guaranteed maximum is the ceiling of items divided by holes. The even spread is built by giving each hole its share of what remains, which produces counts that differ by at most one.

The reverse question is holes × (target − 1) + 1, and the page compares the item count with it to say whether the target is already forced.

The calculation runs entirely in this browser tab; nothing is uploaded.

Put ten items into three holes and some hole must hold at least four. The page shows why: an even spread is 4, 3, 3, and every other spread has a hole at least as full, so four is the smallest maximum any arrangement can achieve.

It also answers the reverse question. To force a hole with at least five items you need 3 × 4 + 1 = 13, so ten items do not force it and three more would.

How to use Pigeonhole Principle Calculator

Type the number of items, set the number of holes, and optionally a target count for one hole, then press Run. The items can be anything — the principle counts them, it does not look at them.

The output gives the guaranteed maximum as ceil(items / holes), one even spread that reaches it, whether the target is forced, and how many more items would force it if it is not.

Why the even spread is the smallest maximum

If every hole held at most m − 1 items, the total would be at most holes × (m − 1). So when the items exceed that bound, some hole must hold m. Taking m = ceil(items / holes) is the smallest m for which the bound is exceeded, which is why it is the guaranteed maximum and why no better bound exists.

The even spread is built greedily — each hole takes its share of what remains — and it reaches the bound. That is the constructive half of the argument: the bound is not only necessary but achievable, so it is the exact answer rather than a loose estimate.

What to Expect

Best for

  • The guaranteed number of items in one hole
  • The minimum count needed to force a given collision
  • A birthday-problem style bound by hand

Not ideal for

  • Distribution probabilities, which need a model of how items are placed
  • A bound on a specific hole rather than some hole
  • Real-world data, where the principle says nothing about which hole

What this tool keeps

  • The item and hole counts exactly

What may need cleanup

  • Nothing: the bound and the spread are final

Common errors

  • A hole count below 1 is refused
  • A negative item count is refused
  • A target below 1 is refused

Example use cases

  • Show that 10 items in 3 holes force 4 in one hole
  • Find how many items force 5 in one hole
  • Check that 13 items with 3 holes force a 5

Sample input

10 items, 3 holes, target 5

Sample output

some hole holds at least 4; 13 items would force 5

Who this is for

  • Students meeting the pigeonhole principle
  • Readers building a collision bound

Frequently asked questions

Why ceil and not floor?

Because 10 items in 3 holes cannot give every hole 3: that would hold only 9. The ceiling is the first count the total exceeds, which is exactly the point at which a hole must be fuller.

Which hole is the full one?

The principle does not say. It proves that at least one hole reaches the bound, and the even spread shows the bound is reachable, but nothing about which item lands where.

How do I force a hole with at least k items?

You need holes × (k − 1) + 1 items. With one fewer, every hole could hold k − 1 and the bound would fail, which is why that count is the exact threshold.

Developer program

Build custom tools for your store

Join the SDK program to create useful ecommerce utilities for your store.