Lah Number Calculator
Combinatorics
- The Lah number L(n, k) counts the ways to split n labelled balls into k nonempty linearly ordered blocks (lists, not sets).
- Use L(n, k) = C(n - 1, k - 1) x n! / k!: here C(4, 1) = 4 and 5! / 2! = 60.
- Multiplying gives L(5, 2) = 240.
- Lah numbers are the change-of-basis between rising and falling factorials, the ordered cousins of the Stirling numbers.
The Lah Number Calculator gives you the unsigned Lah number L(n, k), which counts the ways to split n labelled balls into k nonempty linearly ordered blocks — that is, lists rather than sets, so the order inside each block matters. Enter n and k and the calculator returns L(n, k) using the formula L(n, k) = C(n - 1, k - 1) x n! / k!. For example, L(5, 2) = 240, L(6, 3) = 1200 and L(7, 3) = 12600. If you add every k for a fixed n, the row sums come to 1, 3, 13, 73, 501, 4051 and 37633 for n = 1 to 7.
This formula is the accepted standard for the calculation because it follows directly from how Lah numbers are defined: choosing the split of labelled balls into ordered lists gives exactly C(n - 1, k - 1) x n! / k!. The same numbers serve as the change-of-basis coefficients between rising and falling factorials, which is why they appear in combinatorics and in algebra. This page shows the formula, step-by-step workings, worked examples and sources, so you can check each result yourself rather than take the answer on trust.
Worked examples
L(5, 2)
(5 · 2)
| L(5, 2), the unsigned Lah number | 240 |
| row sum for n = 5 (all k combined) | 501 |
| L(5, 1) - everything in one ordered block | 120 |
| L(5, 5) - every element alone | 1 |
L(6, 3)
(6 · 3)
| L(6, 3), the unsigned Lah number | 1,200 |
| row sum for n = 6 (all k combined) | 4,051 |
| L(6, 1) - everything in one ordered block | 720 |
| L(6, 6) - every element alone | 1 |
L(7, 3)
(7 · 3)
| L(7, 3), the unsigned Lah number | 12,600 |
| row sum for n = 7 (all k combined) | 37,633 |
| L(7, 1) - everything in one ordered block | 5,040 |
| L(7, 7) - every element alone | 1 |
What is a Lah number?
A Lah number answers a specific counting question: in how many ways can you split n labelled balls into k nonempty blocks when the order of items inside each block matters? The unsigned Lah number L(n, k) counts exactly these arrangements. The key word is ordered. If you were dividing balls into plain groups, the order within a group would be irrelevant, and you would be counting set partitions. Here each block is a list, not a set, so putting ball A before ball B is a different outcome from putting ball B before ball A. Same balls, same grouping, different result.
The formula makes the structure visible: L(n, k) = C(n - 1, k - 1) x n! / k!. It combines three ingredients. The binomial coefficient C(n - 1, k - 1) chooses where the divisions between blocks fall. The factor n! orders all n labelled balls in a line. The division by k! corrects for the fact that the order of the blocks themselves does not matter — only the order inside each block does.
Work L(5, 2) with that formula. The binomial coefficient C(4, 1) equals 4. The factorial 5! equals 120, and 2! equals 2, so n! / k! is 120 / 2 = 60. Multiply: 4 x 60 = 240. So L(5, 2) = 240. In plain terms, there are 240 distinct ways to arrange five labelled balls into two nonempty ordered lists. The same formula gives L(6, 3) = 1200 and L(7, 3) = 12600, so the counts climb quickly as n grows.
Adding up every value of k for a fixed n gives the row sums of the Lah triangle. For n = 1 to 7 those totals run 1, 3, 13, 73, 501, 4051, 37633. Each total counts all the ways to split n labelled balls into any number of nonempty ordered blocks, from a single list down to n blocks of one ball each.
Lah numbers also appear outside pure counting. They are the change-of-basis coefficients between rising and falling factorials, which means they let you rewrite an expression built from one type of factorial in terms of the other. That connection is why the Lah number turns up in algebra and combinatorics as well as in straightforward counting problems.
The Lah formula
The Lah formula is short: L(n, k) = C(n - 1, k - 1) x n! / k!. Each piece of that expression has a job, and building it in stages makes the calculation easy to follow and easy to check.
Start with the binomial factor, C(n - 1, k - 1). It chooses which of the n - 1 gaps between the n labelled balls get cut to create k groups. Next, multiply by n!, the number of ways to line up all n balls in a row. Then divide by k!, because the k blocks are lists placed in order, and dividing removes the arrangements that differ only in how the blocks themselves are sequenced. The result is the unsigned Lah number L(n, k): the count of ways to split n labelled balls into k nonempty linearly ordered blocks - lists, not sets.
A worked example confirms the formula. Take L(6, 3). The binomial factor is C(5, 2), which equals 10. Multiply by 6!, or 720, to get 7,200. Divide by 3!, or 6, and the answer is 1,200. That matches the known value L(6, 3) = 1200. The same stages reproduce the other listed values: L(5, 2) = 240 and L(7, 3) = 12600. Adding across all k for a fixed n gives the row sums 1, 3, 13, 73, 501, 4051 and 37633 for n = 1 to 7, a quick way to sanity-check a full row of Lah numbers.
The formula also explains why Lah numbers appear in algebra. They are the change-of-basis coefficients between rising and falling factorials, so the same L(n, k) values that count ordered splits of labelled balls also convert a rising factorial into a sum of falling factorials.
When you use a Lah number calculator, the stages above are what the tool runs: binomial coefficient, then factorial of n, then division by factorial of k. Checking each stage by hand, as with L(6, 3) = 1200, keeps the result trustworthy.
The Lah triangle
The Lah triangle lays out the unsigned Lah numbers row by row, with n starting at 1 and k running from 1 to n. Each entry L(n, k) counts the ways to split n labelled balls into k nonempty linearly ordered blocks — lists, not sets. That ordering requirement is what separates Lah numbers from Stirling numbers: rearranging the balls within a block produces a different arrangement, so the counts grow quickly as n increases.
The first seven rows, together with their row sums, are shown below. Row sums combine all k values for a given n and run 1, 3, 13, 73, 501, 4051, 37633 for n = 1 to 7. The table also includes the individual entries that follow from the formula L(n, k) = C(n - 1, k - 1) × n! / k!, such as L(5, 2) = 240, L(6, 3) = 1200 and L(7, 3) = 12600.
Reading across a row shows how the count changes with the number of blocks. For n = 7, the entries climb from L(7, 1) = 5040 through the middle values and peak before falling back at k = 7. The largest single entry in that row is 12600 at k = 3, which matches the stated value. The row sum of 37633 is the total number of ways to split 7 labelled balls into any number of nonempty linearly ordered blocks.
The Lah number also serves as a change-of-basis coefficient between rising and falling factorials. That means the triangle can be used to convert expressions written in one factorial basis into the other, with the entries of the Lah triangle providing the weights. The table below gives the small values and row sums needed for such conversions at small n.
| n | L(n, 1) | L(n, 2) | L(n, 3) | L(n, 4) | L(n, 5) | L(n, 6) | L(n, 7) | Row sum |
|---|---|---|---|---|---|---|---|---|
| 1 | 1 | 1 | ||||||
| 2 | 2 | 1 | 3 | |||||
| 3 | 6 | 6 | 1 | 13 | ||||
| 4 | 24 | 36 | 12 | 1 | 73 | |||
| 5 | 120 | 240 | 120 | 20 | 1 | 501 | ||
| 6 | 720 | 1800 | 1200 | 300 | 30 | 1 | 4051 | |
| 7 | 5040 | 15120 | 12600 | 4200 | 630 | 42 | 1 | 37633 |
Lah vs Stirling numbers
The Lah number L(n, k) counts the ways to split n labelled balls into k nonempty linearly ordered blocks — lists, not sets. That single word "ordered" is what separates Lah numbers from the two families of Stirling numbers, which count the same kind of partition but with less structure inside each block. Put the three side by side and the distinction is easy to hold onto: Stirling numbers of the second kind count plain sets, Stirling numbers of the first kind count cycles, and Lah numbers count lists.
A Stirling number of the second kind, written S(n, k), counts the ways to divide n labelled items into k nonempty blocks where the order inside each block does not matter. {1, 2} and {2, 1} are the same block. A Lah block is a list, so {1, 2} and {2, 1} are different outcomes. This is why the Lah count for a given n and k exceeds the Stirling second-kind count: every set of size m can be arranged into m! different lists, and the Lah number adds up those arrangements across all the blocks. The Stirling number of the first kind, by contrast, counts permutations of n items with exactly k cycles — again a different internal structure, since a cycle has no first or last element.
The numbers make the gap concrete. L(5, 2) = 240, L(6, 3) = 1200 and L(7, 3) = 12600. The formula behind them is L(n, k) = C(n - 1, k - 1) x n! / k!, which builds the count from a binomial choice, a factorial for the labelling, and a division by k! that corrects for the blocks being unlabelled as a group even though each block is internally ordered. Row sums — all k combined — run 1, 3, 13, 73, 501, 4051, 37633 for n = 1 to 7.
There is a second, more algebraic way to see the difference. Lah numbers are the change-of-basis coefficients between rising and falling factorials. In other words, if you want to rewrite a rising factorial as a combination of falling factorials, the Lah numbers are the weights that appear. The Stirling numbers play the same connective role in their own pairs of bases, which is a neat way to remember that all three families describe the same underlying act of partitioning, just with different rules about what happens inside each block.
So when you are deciding which number to reach for, ask what a block is allowed to be. If a block is a set, use Stirling numbers of the second kind. If it is a cycle, use the first kind. If it is a list — ordered from first to last — the Lah number is the right count, and the formula above will give it to you directly.
FAQs
What does L(n, k) count?
L(n, k) counts the ways to partition n labelled items into k nonempty linearly ordered blocks. Each block is not just a group; the items inside it also have a defined order. This makes Lah numbers different from Stirling numbers, which count unordered blocks.
What is L(5, 2)?
L(5, 2) is 240. That means there are 240 ways to split 5 labelled items into 2 nonempty blocks where each block has an internal order. Use the calculator to check this value or explore nearby inputs.
What is L(7, 3)?
L(7, 3) is 12600. This is the count of ways to divide 7 labelled items into 3 nonempty linearly ordered blocks. Enter n = 7 and k = 3 in the calculator to confirm this result.
What is L(n, 1)?
L(n, 1) equals n!. With only one block, the single block must contain all n items, and the only remaining choice is their order. So the count is simply the number of orderings of all n items, which is n factorial.
What is L(n, n)?
L(n, n) is 1. When there are as many blocks as items, every block must hold exactly one item, so each item sits alone in its own block. There is only one way to arrange that, regardless of n.
How do Lah numbers relate to factorials?
Lah numbers convert between rising and falling factorials. Specifically, x raised to the n-th rising power expands with Lah coefficients. This connection makes Lah numbers useful for changing between these two factorial forms in algebra and combinatorics.