Function Repository Resource:

DelannoyD

Source Notebook

Evaluate the Delannoy number

Contributed by: Jan Mangaldan

ResourceFunction["DelannoyD"][n,m]

gives the Delannoy number D(n,m).

Details

Integer mathematical function, suitable for both symbolic and numerical manipulation.
D(n,m) counts the number of lattice paths from {0,0} to {m,n} in which only east, north and northeast steps are allowed.
ResourceFunction["DelannoyD"] automatically threads over lists.

Examples

Basic Examples (1) 

Evaluate a Delannoy number:

In[1]:=
ResourceFunction["DelannoyD"][5, 8]
Out[1]=

Scope (1) 

DelannoyD threads elementwise over lists:

In[2]:=
ResourceFunction["DelannoyD"][{2, 4, 6}, 2]
Out[2]=

Applications (2) 

Plot Delannoy numbers on a logarithmic scale:

In[3]:=
ListPlot3D[
 Table[Log10[ResourceFunction["DelannoyD"][n, m]], {n, 60}, {m, 60}]]
Out[3]=

Find a formula for the central Delannoy numbers:

In[4]:=
FindSequenceFunction[
 Table[ResourceFunction["DelannoyD"][n, n], {n, 10}], n]
Out[4]=

Properties and Relations (2) 

Generate values from the generating function:

In[5]:=
With[{n = 8, m = 5}, SeriesCoefficient[1/(1 - x - y - x y), {x, 0, n}, {y, 0, m}]]
Out[5]=
In[6]:=
ResourceFunction["DelannoyD"][8, 5]
Out[6]=

Express the Delannoy number as a finite sum:

In[7]:=
With[{n = 8, m = 5}, \!\(
\*UnderoverscriptBox[\(\[Sum]\), \(j = 0\), \(n\)]\(
\*SuperscriptBox[\(2\), \(j\)] Binomial[n, j] Binomial[m, j]\)\)]
Out[7]=
In[8]:=
ResourceFunction["DelannoyD"][8, 5]
Out[8]=

Neat Examples (1) 

Fractal-like pattern generated by a Delannoy number mod 7:

In[9]:=
With[{m = 7}, ArrayPlot[
  Mod[With[{d = 256}, Array[ResourceFunction["DelannoyD"], {d, d} + 1, {0, 0}]], m],
  ColorFunction -> (Hue[#/10] &), ColorFunctionScaling -> False]]
Out[9]=

Version History

  • 1.0.0 – 17 May 2021

Related Resources

License Information