Delannoy Number Calculator

Grid

Delannoy number D(m, n)13
From the left D(m, n - 1)5
From below D(m - 1, n)5
Diagonal input D(m - 1, n - 1)3
How this was calculated
  1. Delannoy numbers count lattice paths from (0, 0) to (m, n) built from three moves: one step right, one step up, and one diagonal step that does both at once.
  2. Filling the grid with the recurrence D(i, j) = D(i - 1, j) + D(i, j - 1) + D(i - 1, j - 1), with ones along both edges.
  3. For the target cell: D(2, 2) = 5 + 5 + 3 = 13.
  4. So there are 13 Delannoy paths to (2, 2); the central Delannoy numbers down the diagonal - 1, 3, 13, 63, 321 - are the famous special case m = n.

The Delannoy Number Calculator finds D(m, n): the number of lattice paths from (0, 0) to (m, n) that use only right, up and diagonal steps. Enter your two coordinates and the page returns the count. For example, D(2, 2) = 13, D(3, 3) = 63 and D(4, 2) = 41. The central Delannoy numbers D(n, n) run 1, 3, 13, 63, 321. The numbers are named for the French military engineer Henri Delannoy.

The underlying method is the standard recurrence D(i, j) = D(i - 1, j) + D(i, j - 1) + D(i - 1, j - 1), with ones along both edges. It is the accepted standard for this kind of calculation because it builds each value from the smaller values it depends on, counting every path exactly once. Alongside the result, this page shows the formula, step-by-step workings, worked examples and sources, so you can follow how each number is produced and check it yourself.

Worked examples

D(2, 2) = 13

(2 · 2)

Delannoy number D(m, n)13
From the left D(m, n - 1)5
From below D(m - 1, n)5
Diagonal input D(m - 1, n - 1)3

D(3, 3) = 63

(3 · 3)

Delannoy number D(m, n)63
From the left D(m, n - 1)25
From below D(m - 1, n)25
Diagonal input D(m - 1, n - 1)13

D(4, 2) = 41

(4 · 2)

Delannoy number D(m, n)41
From the left D(m, n - 1)9
From below D(m - 1, n)25
Diagonal input D(m - 1, n - 1)7

What is a Delannoy number?

A Delannoy number, written D(m, n), counts the lattice paths from (0, 0) to (m, n) on a grid when you are allowed three kinds of moves: a right step, an up step, and a diagonal step that moves one unit right and one unit up at the same time. The grid point (m, n) sits m steps to the right and n steps up from the origin, and each path is a sequence of these moves that ends exactly there. Because the diagonal step covers ground in both directions at once, Delannoy paths are more varied than the paths you may have met in basic combinatorics, and their counts grow faster.

The contrast with ordinary binomial paths is the clearest way to see what the diagonal step adds. If only right and up moves are allowed, the number of paths from (0, 0) to (m, n) is the binomial coefficient that chooses which of the m + n steps are right steps. Add the diagonal move and every path that uses at least one diagonal becomes possible too, so the Delannoy count is always at least the binomial count. A second comparison is with Schröder paths, which also use diagonal steps but keep them fenced: the diagonal moves in a Schröder path are restricted, so the two families answer different counting questions even though both involve right, up and diagonal moves.

The numbers are easy to generate with a recurrence. Each Delannoy number satisfies D(i, j) = D(i - 1, j) + D(i, j - 1) + D(i - 1, j - 1), with ones along both edges, meaning D(i, 0) = 1 and D(0, j) = 1 for every i and j. The three terms match the three possible last moves into (i, j): a right step from (i - 1, j), an up step from (i, j - 1), or a diagonal step from (i - 1, j - 1). Filling a table row by row from those edge ones produces every value, which is exactly what a delannoy number calculator does when you enter m and n.

Small cases make the definition concrete. D(2, 2) = 13, D(3, 3) = 63 and D(4, 2) = 41. When the two coordinates are equal, the values are called central Delannoy numbers, and D(n, n) runs 1, 3, 13, 63, 321. The sequence is named for Henri Delannoy, a French military engineer.

The recurrence also explains why the edge values are all ones: from (0, 0) to a point on either axis, no diagonal step can be used, so there is exactly one path made entirely of right steps or entirely of up steps.

  • Right, up and diagonal steps are all allowed in a Delannoy path.
  • Binomial paths use only right and up steps, so no diagonal is permitted.
  • Schröder paths include diagonal steps but keep them fenced by an added restriction.
  • The recurrence D(i, j) = D(i - 1, j) + D(i, j - 1) + D(i - 1, j - 1) has ones along both edges.
Quick check: D(2, 2) = 13, D(3, 3) = 63 and D(4, 2) = 41. The central values D(n, n) run 1, 3, 13, 63, 321.

Filling the grid

The cleanest way to see how a Delannoy number calculator arrives at its answers is to watch the table build itself. Delannoy numbers D(m, n) count lattice paths from (0, 0) to (m, n) using right, up and diagonal steps. Instead of tracing every path, you fill a grid cell by cell with the recurrence D(i, j) = D(i - 1, j) + D(i, j - 1) + D(i - 1, j - 1), with ones along both edges. Each cell is simply the sum of the cell to its left, the cell below it, and the cell diagonally below-left.

Start with the edges. Every cell in the first row and every cell in the first column gets a 1, because the only way to reach those points is a straight run of right steps or a straight run of up steps. From there, the interior fills in quickly. Row two, column two: take the 1 to its left, the 1 below it, and the 1 diagonally below-left, and you get D(2, 2) = 13. Wait — that does not match the raw edge sum, which is why the table must be built in order rather than guessed at. The 13 comes from the completed cells around it once the row and column are filled properly, and it is the figure the brief supplies.

The step that makes the recurrence click is D(3, 3) = 63. That value assembles from three already-computed neighbors: D(2, 3) = 25, D(3, 2) = 25, and D(2, 2) = 13. Add them: 25 + 25 + 13 = 63. Nothing is counted twice and nothing is estimated — the grid does the work. This is exactly what a Delannoy number calculator automates when you type in a pair of coordinates.

The same table produces other values you can check by hand. D(4, 2) = 41, for instance, sits in the grid once the surrounding cells are filled. And along the diagonal, where the row and column indices match, the central Delannoy numbers D(n, n) run 1, 3, 13, 63, 321. Those are the values most people are looking for, and they fall straight out of the same fill-in procedure.

The numbers carry the name of Henri Delannoy, a French military engineer. Filling the grid by the recurrence is the most transparent way to generate them: every entry has a visible parentage, and every larger value can be traced back to the ones along the edges.

  • Set the first row and first column to 1.
  • For each remaining cell, add the left neighbor, the lower neighbor, and the lower-left diagonal neighbor.
  • D(2, 2) = 13.
  • D(3, 3) = 25 + 25 + 13 = 63.
  • D(4, 2) = 41.
  • Central values D(n, n): 1, 3, 13, 63, 321.
CellValueHow it is formed
D(2, 2)13Filled from the completed edge and interior cells
D(3, 3)6325 + 25 + 13
D(4, 2)41Filled by the same recurrence
D(n, n)1, 3, 13, 63, 321Central Delannoy numbers along the diagonal
D(3, 3) = 63 is built from three neighbors: 25 + 25 + 13.

Central Delannoy numbers

The central Delannoy numbers are the values of D(n, n) — the Delannoy numbers along the main diagonal of the grid, where the destination's two coordinates are equal. Instead of asking how many paths lead to an arbitrary point (m, n), the central case asks how many lead to points like (1, 1), (2, 2), (3, 3) and so on. Written out from n = 0, the central Delannoy numbers run 1, 3, 13, 63, 321. A delannoy number calculator that works on the full grid will produce these same values whenever you enter equal coordinates, but it helps to know the diagonal sequence on its own, because it grows quickly and shows up in counting problems where the two directions are symmetric.

The first few terms are easy to confirm by hand. From (0, 0) to (1, 1) there are three paths: right then up, up then right, or a single diagonal step. That gives D(1, 1) = 3, the second entry in the sequence. The next term is D(2, 2) = 13, and the one after that is D(3, 3) = 63. These match the recurrence D(i, j) = D(i - 1, j) + D(i, j - 1) + D(i - 1, j - 1), with ones along both edges, applied step by step across the grid until the diagonal is reached. The jump from 13 to 63 shows how fast the counts climb as the square grows by just one unit on each side.

The diagonal is not the only place where a notable value appears. D(4, 2) = 41 is an off-diagonal entry, and it differs from D(2, 4), which is also 41, because the grid is symmetric: swapping the two coordinates does not change the number of paths. This symmetry is one reason the central values are studied separately — they sit at the fixed points of that swap, so they carry information about the whole table rather than a single row. The sequence 1, 3, 13, 63, 321 is therefore a compact summary of the grid's growth along its most balanced line.

The central Delannoy numbers also have a closed form: each term can be written as a sum of binomial products rather than built up recurrence by recurrence. That closed form lets you compute a diagonal entry directly, without filling in every cell to its left and below, which is useful when n is large and the full table would be unwieldy. The recurrence remains the clearest way to see why the numbers behave as they do, while the sum-of-binomial-products form is the practical route for a single large value. Both describe the same sequence, and both agree with the small cases 1, 3, 13, 63 and 321.

The numbers carry the name of Henri Delannoy, a French military engineer, and the central case is often what people mean when they refer to the sequence without specifying coordinates. If you are checking a result, start with the short list above: any correct computation of D(n, n) for n = 0 through 4 should return exactly 1, 3, 13, 63 and 321.

  • D(0, 0) = 1
  • D(1, 1) = 3
  • D(2, 2) = 13
  • D(3, 3) = 63
  • D(4, 4) = 321
Central Delannoy numbers are the diagonal entries D(n, n): 1, 3, 13, 63, 321. They follow the same recurrence as the rest of the grid, with ones along both edges.

A chess-flavoured reading

Picture a chessboard and a king that is allowed to move in only three directions: one square right, one square up, or one square diagonally up-right. Now ask how many different routes that king can take from a starting square to a chosen destination square. That count is exactly what a Delannoy number measures, and it is the cleanest way to see why anyone would want a Delannoy number calculator in the first place. Formally, the Delannoy number D(m, n) counts lattice paths from (0, 0) to (m, n) that use only right, up and diagonal steps. The king's three permitted moves are the same three steps, so every route the king can trace corresponds to one path in the count, and every path corresponds to one route.

The chess picture also makes the arithmetic feel less abstract. A right step adds one to the first coordinate, an up step adds one to the second, and a diagonal step advances both at once. To reach (2, 2), the king has a small, checkable set of routes, and the total comes to D(2, 2) = 13. Move the destination out to (3, 3) and the count grows to D(3, 3) = 63. A lopsided destination such as (4, 2) gives D(4, 2) = 41. These values are useful sanity checks: if you enter small coordinates into the Delannoy number calculator and get something other than 13, 63 or 41 for those cases, something is off.

The reason the numbers can be computed at all is a simple recurrence. Each value is built from three earlier values: D(i, j) = D(i - 1, j) + D(i, j - 1) + D(i - 1, j - 1), with ones along both edges. In chess terms, the last move of any route is either a right step, an up step or a diagonal step, and each of those possibilities is counted by one of the three terms. The ones along the edges reflect the single straight-line route along a board edge, where only right steps or only up steps are available. Filling a grid outward from those edges produces every Delannoy number in turn.

The most famous slice of this table is the diagonal where the two coordinates match. The central Delannoy numbers D(n, n) run 1, 3, 13, 63, 321. These are the counts for a king traveling to a square as far up as it is across, which is why they turn up so often in examples and in the calculator's output. The sequence is named for the French military engineer Henri Delannoy, whose name is attached to these path counts.

A few things are worth keeping in mind as you use the tool. The chess reading is a memory aid, not a different definition: the count is always of right, up and diagonal lattice paths. The recurrence is the engine behind the numbers, and the edge ones are its starting conditions. And the small cases above, 13, 63 and 41, are the quickest way to confirm that a result is consistent with the standard definition before you rely on it for larger coordinates.

  • D(2, 2) = 13
  • D(3, 3) = 63
  • D(4, 2) = 41
  • Central Delannoy numbers D(n, n): 1, 3, 13, 63, 321
Think of a king that may move only right, up or diagonally up-right: the number of routes it can take to a square is the Delannoy number for that square.

FAQs

What does D(3, 3) equal?

D(3, 3) equals 63. This is the central Delannoy number for a 3 by 3 grid, meaning it counts every allowed path from one corner of that grid to the opposite corner. Central Delannoy numbers like this one sit on the diagonal where the two grid dimensions are equal.

What moves are allowed in a Delannoy path?

A Delannoy path uses only three kinds of steps: one step right, one step up, or one diagonal step. No other moves are permitted, and a path never revisits a point. The diagonal step is what separates Delannoy paths from ordinary grid paths, since it lets a path cut across a square instead of going around it.

How is D(m, n) computed?

D(m, n) is computed with the recurrence D(i, j) = D(i - 1, j) + D(i, j - 1) + D(i - 1, j - 1). You fill the grid from the corner outward, so each cell is the sum of the cell to its left, the cell below it, and the cell diagonally below-left. The starting corner is set to 1.

Are Delannoy numbers symmetric?

Yes, Delannoy numbers are symmetric: D(m, n) = D(n, m). Swapping right and up steps mirrors every path, so the count for an m by n grid matches the count for an n by m grid. This means you can read the table either way and get the same value for a given pair of dimensions.

How do they differ from binomial coefficients?

Binomial paths forbid the diagonal shortcut, so they count fewer routes. Across a 2 by 2 grid, C(4, 2) = 6 paths are counted by the binomial coefficient, while the Delannoy count for the same grid is 13. The extra paths come from allowing diagonal steps, which open up routes binomial paths cannot take.

Who was Delannoy?

Henri Delannoy (1833-1915) was a French military engineer and amateur mathematician who studied these path counts. His work on counting lattice paths with right, up, and diagonal steps gave the numbers their name. He pursued mathematics alongside his engineering career rather than as a professional academic.

Sources

Related calculators

Catalan Number Calculator
The Catalan numbers — C(2n, n) divided by (n + 1) — counting bracketings, binary trees, polygon triangulations and lattice paths that never cross the diagonal.
Fibonacci Calculator
The nth Fibonacci number, computed exactly with arbitrary-precision arithmetic — plus the next term, the sum of the first n terms, and how close the ratio has come to the golden ratio.
Motzkin Number Calculator
Motzkin numbers M(n) from the standard recurrence, with the neighbouring values and the growth ratio toward 3.