Eulerian Number Calculator
Inputs
- The Eulerian number A(4, 1) counts the permutations of 4 elements that have exactly 1 descents, positions where the next element is smaller.
- The alternating sum formula gives A(4, 1) = 11.
- All 24 permutations split across the descent counts 0 to 3, and this row is symmetric: A(4, 1) equals A(4, 2) = 11.
- So 45.8 percent of the permutations of 4 elements have exactly 1 descents.
This Eulerian number calculator finds A(n, m), the Eulerian number that counts the permutations of n elements with exactly m descents. A descent is a position in a permutation where the next element is smaller than the current one. Enter n and m, and the calculator returns the count directly. For example, A(4, 1) = 11: of the 24 permutations of four elements, exactly 11 have one descent. As a larger check, A(5, 2) = 66, which is 55.0 percent of the 120 permutations of five elements. The counts behave in ways you can verify: every row sums to n factorial, so the values for n = 6 across 0 to 5 descents add to 720, and A(6, 0) = 1 because only the fully sorted permutation has no descents. Rows are also symmetric, since A(n, m) = A(n, n - 1 - m): reversing a permutation swaps descents and ascents.
The method behind the calculator is the standard combinatorial definition of Eulerian numbers: counting permutations by their number of descents. That same definition is what makes the checks above work, including the row total of n factorial and the symmetry A(n, m) = A(n, n - 1 - m). On this page you can see the formula, step-by-step workings, worked examples such as A(4, 1) = 11 and A(5, 2) = 66, and the sources used, so you can follow each result rather than take it on trust.
Worked examples
Four elements, one descent
(4 · 1)
| Eulerian number A(n, m) | 11 |
| All permutations (n!) | 24 |
| Share of permutations | 45.8% |
| Mirror value A(n, n-1-m) | 11 |
Five elements, two descents
(5 · 2)
| Eulerian number A(n, m) | 66 |
| All permutations (n!) | 120 |
| Share of permutations | 55.0% |
| Mirror value A(n, n-1-m) | 66 |
Six elements, sorted only
(6 · 0)
| Eulerian number A(n, m) | 1 |
| All permutations (n!) | 720 |
| Share of permutations | 0.1% |
| Mirror value A(n, n-1-m) | 1 |
Descents, counted
A descent in a permutation is a position where the next element is smaller than the current one. Take the four elements 1, 2, 3, 4 and read a permutation left to right, comparing each element with the one right after it. In 1 3 2 4, the step from 3 down to 2 is a descent, and every other step goes up, so this permutation has exactly one descent. In 4 1 2 3, the drop from 4 to 1 is the only descent. In 2 1 4 3, there are two: 2 down to 1, and 4 down to 3. The Eulerian number A(n, m) counts the permutations of n elements with exactly m descents, so building the n = 4 row means sorting all 24 permutations of four elements by how many descents each one has.
The cleanest way to see the row take shape is to count by where the descent falls. A permutation of four elements can have at most three descents, since there are only three adjacent pairs to compare. Zero descents means the permutation rises at every step, and only 1 2 3 4 does that, so A(4, 0) = 1. Three descents means it falls at every step, and only 4 3 2 1 does that, so A(4, 3) = 1. The middle values carry the rest of the weight. A(4, 1) = 11 of the 24 permutations of four elements have exactly one descent, and by the symmetry of the rows, A(4, 2) is also 11. Adding them up: 1 + 11 + 11 + 1 = 24, which is 4 factorial, exactly as every row of Eulerian numbers must sum.
That symmetry is not a coincidence. Reversing a permutation swaps descents and ascents, so A(n, m) = A(n, n - 1 - m). The one-descent permutations of four elements pair off with the two-descent ones under reversal, which is why both counts land on 11. The same structure shows up at larger n. For n = 6, the counts across 0 to 5 descents add to 720, and A(6, 0) = 1 because only the fully sorted permutation has no descents at all. As a further check on the pattern, A(5, 2) = 66, which is 55.0 percent of the 120 permutations of five elements.
An eulerian number calculator does this bookkeeping for you, but the n = 4 row is small enough to reason through by hand, and doing so makes the definition stick. Count the descents in each of the 24 permutations, tally them by count, and you get 1, 11, 11, 1. The 11 in the second position is the number to remember: it is the count of four-element permutations with exactly one place where the sequence steps down.
The triangle of Eulerian numbers
The Eulerian number A(n, m) counts the permutations of n elements with exactly m descents — positions where the next element is smaller than the current one. Because the count depends only on n and m, the values arrange themselves into a triangle much like Pascal's, with one row for each n. An eulerian number calculator reads a row of this triangle directly, so it helps to see how the rows are built before you use one.
Row n = 6 shows the full shape of a row: 1, 57, 302, 302, 57, 1, read across 0 to 5 descents. The symmetry is visible at a glance — the second entry equals the second-to-last, and the third equals the third-to-last. That is the general rule A(n, m) = A(n, n - 1 - m): reversing a permutation swaps descents and ascents, so counting permutations with m descents is the same as counting those with n - 1 - m descents.
The row totals tie the triangle back to factorials. Every row sums to n factorial, so the counts for n = 6 across 0 to 5 descents add to 720. The same pattern holds further down: one row totals 24, another 120, another 720. The first entry of each row is always 1, and for n = 6 that is A(6, 0) = 1 because only the fully sorted permutation has no descents.
Individual entries are worth checking against the definition. A(4, 1) = 11: of the 24 permutations of four elements, exactly 11 have exactly one descent. Higher up, A(5, 2) = 66, which is 55.0 percent of the 120 permutations of five elements. These two values sit in the table below and show how quickly the middle of a row grows relative to its ends.
| n | A(n, 0) | A(n, 1) | A(n, 2) | A(n, 3) | A(n, 4) | A(n, 5) | Row sum |
|---|---|---|---|---|---|---|---|
| 1 | 1 | 1 | |||||
| 2 | 1 | 1 | 2 | ||||
| 3 | 1 | 4 | 1 | 6 | |||
| 4 | 1 | 11 | 11 | 1 | 24 | ||
| 5 | 1 | 26 | 66 | 26 | 1 | 120 | |
| 6 | 1 | 57 | 302 | 302 | 57 | 1 | 720 |
Two ways to compute A(n, m)
The Eulerian number A(n, m) counts the permutations of n elements with exactly m descents — positions where the next element is smaller than the current one. Two standard methods produce these values: a recurrence that builds row by row, and an alternating sum that computes a single entry directly. A good eulerian number calculator can use either, and knowing how both work helps you check its output.
The recurrence is A(n, m) = (n - m) A(n - 1, m - 1) + (m + 1) A(n - 1, m). Each new row is assembled from the row above by splitting every permutation of n - 1 elements into two groups. The first term counts extensions that add a descent, and the second counts extensions that do not. Starting from A(1, 0) = 1, the recurrence fills the triangle one row at a time, which makes it a natural fit for a table or a loop in code. As a check, A(4, 1) = 11: of the 24 permutations of four elements, 11 have exactly one descent. The recurrence gives 11 as well, and A(5, 2) = 66, which is 55.0 percent of the 120 permutations of five elements.
The alternating sum formula computes A(n, m) without building any earlier rows. It expresses A(n, m) as a sum of terms involving powers and binomial coefficients, with signs that alternate across the sum. For a single entry this is often faster than filling the whole triangle, and it is the method the calculator uses. The two approaches must agree, and two properties make that easy to verify. Every row sums to n factorial: the counts for n = 6 across 0 to 5 descents add to 720, and A(6, 0) = 1 because only the fully sorted permutation has no descents. Rows are also symmetric: A(n, m) = A(n, n - 1 - m), since reversing a permutation swaps descents and ascents.
In practice, the choice comes down to what you need. If you want a whole row or a table of values, the recurrence is the direct route. If you want one value for a large n and m, the alternating sum avoids the work of computing everything below it. Either way, the row-sum and symmetry checks give you a quick way to confirm that a result is consistent with its neighbors in the triangle.
- Recurrence: A(n, m) = (n - m) A(n - 1, m - 1) + (m + 1) A(n - 1, m), built row by row from A(1, 0) = 1.
- Alternating sum: computes a single A(n, m) directly, without filling in earlier rows — the method the calculator uses.
- Check with a worked example: A(4, 1) = 11, since 11 of the 24 permutations of four elements have exactly one descent.
- Check with a row sum: for n = 6, the counts across 0 to 5 descents add to 720, and A(6, 0) = 1.
- Check with symmetry: A(n, m) = A(n, n - 1 - m), because reversing a permutation swaps descents and ascents.
Where Eulerian numbers appear
Eulerian numbers are usually introduced as a counting tool, but their real value shows up when you use them to describe patterns. A good eulerian number calculator lets you move past a single count and see the shape of an entire row of values. The Eulerian number A(n, m) counts the permutations of n elements with exactly m descents, where a descent is a position where the next element is smaller than the current one. That definition turns a plain list of arrangements into a measure of how disordered each one is.
The most direct application is the study of sorting statistics. If you shuffle a list and want to know how much work a simple sorting routine will face, descents are a natural indicator: a permutation with no descents is already in order, while one with many descents is badly scrambled. The counts make this concrete. For four elements, A(4, 1) = 11, meaning 11 of the 24 permutations have exactly one descent. For five elements, A(5, 2) = 66, which is 55.0 percent of the 120 permutations. Rather than checking arrangements one by one, you can read the distribution straight from the row.
As n grows, the row takes on a familiar profile. The counts are largest near the middle and taper toward both ends, and the distribution of permutation descents approaches a normal curve. Two structural facts explain the shape. Every row sums to n factorial: the counts for n = 6 across 0 to 5 descents add to 720, and A(6, 0) = 1 because only the fully sorted permutation has no descents. Rows are also symmetric, since A(n, m) = A(n, n - 1 - m), because reversing a permutation swaps descents and ascents. That symmetry is why the profile is balanced around its center.
Euler's original motivation was different from sorting. He studied sums of powers and found that the same numbers govern the formulas for adding consecutive powers of the integers. The coefficients that appear when you express such a sum as a polynomial are Eulerian numbers, which is why they carry his name. The same array that counts descents in permutations therefore also encodes algebraic identities, a connection that has kept the numbers central in combinatorics.
Seeing these three contexts together is the point of working with the rows rather than isolated values. A calculator that returns a full row lets you check the factorial sum, confirm the symmetry, and compare the middle counts against the total, all at once.
FAQs
What is an Eulerian number?
An Eulerian number, written A(n, m), counts permutations of n elements that have exactly m descents. A descent is a place where the sequence drops, meaning a value is followed by a smaller one. So each Eulerian number tells you how many orderings of n items have exactly that many drops in them.
What is A(4, 1)?
A(4, 1) equals 11. There are 24 permutations of four elements in total, and 11 of them have exactly one descent. That works out to 45.8 percent of all the four-element permutations. The calculator shows this count directly, so you can see which permutations fall into that group.
Why is A(n, 0) always 1?
A(n, 0) counts permutations with no descents at all. Only one permutation qualifies: the identity permutation, which is fully ascending, with every value smaller than the next. Because that single ordering is the only one with zero descents, A(n, 0) is always 1 for every n.
Do Eulerian numbers have a formula?
Yes. There is an alternating sum over binomial coefficients, and there is also a simple recurrence that builds each row from the row above. The calculator cross-checks both methods against the row sum, which must equal n factorial. If the two approaches agree and the row totals n!, you can trust the displayed values.
What is the largest Eulerian number this calculator handles?
This calculator handles n up to 12. At that size the middle values of the row run into the millions, so the numbers get large. Even so, the row still sums exactly to 12 factorial, which the calculator verifies. Beyond n of 12 the values grow too large for this tool to display reliably.
Are Eulerian numbers the same as Euler's numbers?
No, they are different sequences. Euler's zigzag numbers form a separate sequence, sometimes called up/down numbers. Eulerian numbers are the descent counts, named after Euler's work on them. Both carry Euler's name, but they count different things, so don't confuse the two when reading results or comparing tables.