← All articles
mathcountingnumber theorypatternsSeptember 17, 20263 min read

How Many Ways Can You Break Five Into Pieces? Seven, and It Gets Hard Fast

By the BrainSnail editorial team. How these articles are written and checked, and how to tell us when one is wrong.

Counting the ways a whole number can be written as a sum of whole numbers sounds like a schoolroom exercise and turns out to be one of the deeper problems in mathematics.

What is being counted

Take a positive whole number and write it as a sum of positive whole numbers, ignoring the order of the parts. Five can be written as five itself, as four and one, as three and two, as three and one and one, as two and two and one, as two and one and one and one, and as five ones, which is seven ways. Because order is ignored, four plus one and one plus four count as the same. The count for each starting number defines a sequence that begins one, two, three, five, seven, eleven and fifteen.

How fast it grows

The numbers escalate in a way that is hard to anticipate:

  • Ten has forty two ways
  • Fifty has just over two hundred thousand
  • One hundred has more than one hundred and ninety million
  • Two hundred has nearly four thousand million
  • Growth is faster than any polynomial and slower than exponential
  • No simple formula produces the count directly

The pictures that make it tractable

Representing each way as a diagram of rows of dots, one row per part with the largest at the top, converts arithmetic questions into visual ones. Flipping such a diagram along its diagonal turns rows into columns and produces another valid arrangement of the same number, which pairs them up and proves several results almost without calculation. The classic example is that the number of ways using at most three parts equals the number using no part larger than three, which is obvious once the flip is seen and quite obscure otherwise.

Where the count shows up elsewhere

The same quantity answers several questions that do not look related, which is the usual sign of something fundamental. It counts the ways a set of identical objects can be distributed into identical boxes, since neither the objects nor the boxes are distinguishable. It counts the distinct shapes a particular kind of algebraic symmetry can take. It appears in statistical physics when counting how energy can be distributed among identical particles, which is where it entered that subject. And restricted versions, counting only sums of odd numbers or only sums of distinct numbers, generate their own families of results.

The famous story attached

The subject carries one of the best known episodes in modern mathematics. Srinivasa Ramanujan, working in Madras with almost no formal training, sent results to G H Hardy in Cambridge in 1913, and the two collaborated on this problem among others, producing a formula that estimates the count with extraordinary accuracy. Ramanujan also noticed patterns in divisibility, including that the count is divisible by five whenever the starting number leaves a remainder of four on division by five, and similar rules for seven and eleven. Explaining why those hold occupied mathematicians for most of the following century.

The takeaway

Counting the ways a number can be written as a sum, ignoring order, gives seven for five and more than one hundred and ninety million for one hundred, with no simple formula available. Drawing each as rows of dots and flipping the diagram proves results visually. Ramanujan and Hardy produced an extremely accurate estimate, and his divisibility patterns took a century to explain.

Practise this

Questions from Counting and Numbers

Reading about something is not the same as being able to recall it. These are real questions from the Counting and Numbers unit in our Math track, answers and explanations included. The unit has 120 in total across 21 steps.

  • Build the sentenceLevel 1

    1. Build a true sentence about the alphabet.

    Answer: The first letter is A

    A is at the front, so the first letter is A.

  • Choose all that applyLevel 2

    2. Which numbers are less than 25?

    • 19correct
    • 22correct
    • 30
    • 41

    19 and 22 are both under 25; 30 and 41 are not.

  • Multiple choiceLevel 1

    3. How many tens are in the number 12?

    • 1correct
    • 2
    • 12
    • 0

    12 is made of 1 ten and 2 ones, so it has 1 ten.