Stars and Bars Calculator

Enter the items and groups to count the distributions.

How to use

  1. Enter your values in the fields above.
  2. Press Calculate to see your result instantly.
  3. Use the Share button to copy a link to your result.

About this calculator

The stars and bars theorem, a classic result in combinatorics popularized by William Feller, counts the number of ways to partition n identical items among k distinct groups. With empty groups allowed, the count is the binomial coefficient C(n + k − 1, k − 1) — visualized as arranging n stars and k − 1 bars in a row; without empty groups permitted, it becomes C(n − 1, k − 1), since each group must first receive one item before the rest are distributed freely.

This calculator takes your item and group counts, applies the correct binomial coefficient for whichever variant you choose, and returns the number of distinct distributions. Combinatorics students, competitive programmers, and instructors teaching discrete mathematics use it to check homework and contest problems that reduce to "how many ways can identical objects be split among distinct bins" — a pattern that also underlies counting problems in probability, such as distributing indistinguishable balls into labeled urns.

Was this helpful?

Comments (0)

  • Be the first to comment.

Popular calculators

All Calculators