Function Repository Resource:

# EulerianNumber

Get the number of permutations with a given number of ascents

Contributed by: Wolfram Staff
 ResourceFunction["EulerianNumber"][n,k] gives the number of permutations of {1,2,…,n} with k ascents.

## Details and Options

The index i of a permutation written as p1,p2,,pn in one-line notation is an ascent if pi<pi+1.

## Examples

### Basic Examples

Consider the permutation:

 In[1]:=

Here are its four ascents, corresponding to 2<8, 1<5, 4<7, 3<9:

 In[2]:=
 Out[2]=

This counts the number of ascents of the 24 permutations of {1,2,3,4}:

 In[3]:=
 Out[3]=

This tallies up permutations by the number of ascents:

 In[4]:=
 Out[4]=

This gives the same list, calculated without implicitly listing the individual ascents:

 In[5]:=
 Out[5]=

### Scope

The numbers form an infinite lower-triangular matrix:

 In[6]:=
 Out[6]=

The row sums are the factorials because they count the number of permutations:

 In[7]:=
 Out[7]=

### Neat Examples

Here the entries are signed in a checkerboard pattern:

 In[8]:=
 Out[8]=

Here are those row sums:

 In[9]:=
 Out[9]=

Expand Tan[x]:

 In[10]:=
 Out[10]=

Get rid of the factorials in the denominators to match the row sums up to signs and a shift:

 In[11]:=
 Out[11]=