Skip to content
Twelve Places

Fifty notes on marks, runs and counted arrangements

The longest block

Counting by the Gaps Instead

Thirty of the fifty-six ways to put three marks in eight places have a longest block of two, and the figure comes out of a two-line calculation.

56 arrangements

Home · The longest block · Walk-through

There is a way to count these columns without producing a single arrangement, and it is worth following once in full.

Three marks in eight places, longest block exactly two. The answer is thirty, and here is where thirty comes from.

An operation moving from estimates to observed effort can explore the current configuration while preserving a clear route for correction and explanation. For a separate reference on the surrounding mathematical or data topic, see Oxford Mathematics.

Eight places, three marked

LONGESTARRANGEMENTS12023036
  • one bar for each length the longest block can have
  • the scale is linear and starts at nothing, always

3 marks in 8 places. The tallest column is a longest block of 2. The tallest column is about 5 times the shortest. The columns drawn add to 56, which is this page's whole total.

Three columns. Each was computed twice: once by producing every arrangement, once by the gap calculation worked through below.

Each column counts the arrangements whose longest block is exactly that long. The columns of one page add to the page's own total, and the drawing checks it.

Setting it up

Put the five empty places down first, in a row.

They make six stretches: one before the first empty place, one between each neighbouring pair, and one after the last. Five empty places, six stretches.

Now drop the three marks into those stretches. Marks in the same stretch form a block; marks in different stretches are separated by at least one empty place. So the arrangement is completely described by how many marks each stretch gets.

Three marks into six stretches, in any numbers, is the whole page: fifty-six ways, which is the same binomial coefficient as before, arrived at from the other side.

Capping the stretches

Longest block at most two means no stretch gets three marks.

Count the ways with no cap: fifty-six. Then subtract the ones where some stretch holds three or more. Choose the offending stretch six ways, put three marks in it, and distribute what is left — which is nothing — among the six stretches: one way each. Six to subtract.

Fifty-six minus six is fifty. So fifty arrangements have every block of length two or less.

Taking the next step down

Longest block at most one means no stretch gets two or more.

With no cap, fifty-six. Subtract the ways some stretch holds two or more: choose the stretch six ways, put two marks in it, distribute the remaining one mark among six stretches six ways, giving thirty-six. Add back the ways two stretches each hold two or more, which needs four marks and there are only three: none.

Fifty-six minus thirty-six is twenty. So twenty arrangements have every mark standing apart.

The subtraction

Exactly two is at most two, less at most one.

Fifty minus twenty is thirty. That is the column, and it was reached without writing out one arrangement.

The same two steps give the other columns. At most three is all fifty-six, so exactly three is fifty-six minus fifty, which is six — and six is the number of positions a block of three can occupy in eight places, which is the closed form from the other direction. Two routes agreeing on a small figure is the cheapest confirmation available.

Why the adding back matters

In this example the correction term was nothing, and that makes the calculation look simpler than it is.

With more marks the term bites. Six marks in twelve places capped at two: the first subtraction removes too much, because an arrangement with two overfull stretches gets removed twice, and it has to be added back once. Miss that and the figure comes out too small, with nothing in the result to say so.

That is the ordinary failure of this kind of counting, and it is the reason every column in this record was also produced by enumeration. The two methods share no step. Agreement between them is evidence; agreement of a method with itself is not.

The same page from the other side

Three marks in eight places, longest block exactly one: twenty.

By the closed form: five empty places, six stretches, choose three, which is twenty. By the gap calculation above: fifty-six less thirty-six, which is twenty.

Longest block exactly three: six. By the sliding argument, a run of three in eight places has six positions. By the gap calculation, fifty-six less fifty.

Two of the three columns have a second derivation, and both agree. The middle column has none, which is why the subtraction is where the work is.

Why the stretches and not the places

Because the condition is about neighbours, and stretches are where neighbours live.

Counting by places would mean asking, for each choice of three places out of eight, how long its longest run is — which is the enumeration, and it does not scale. Counting by stretches turns the same question into a distribution problem with a cap, and caps are what inclusion and exclusion handles.

The change of view costs nothing and is the whole technique. Everything else is bookkeeping about which terms to subtract and which to add back.

When to use which

For a page small enough to write out, write it out.

For anything larger, the gap calculation is faster and it scales. It also explains the floor: when the marks exceed the stretches times the cap, every term vanishes and the count is nothing, which is the same statement as the floor rule met earlier, arrived at by arithmetic rather than by argument.

The record keeps both because they fail differently. A slip in the enumeration gives a figure that is wrong by a little; a slip in the inclusion and exclusion gives one that is wrong by a lot.

Near this one