# Documentation

### This is machine translation

Translated by
Mouseover text to see original. Click the button below to return to the English verison of the page.

# `combinat`::`catalan`

Catalan numbers

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.

## Syntax

```combinat::catalan(`n`)
```

## Description

`combinat::catalan`(n) returns the `n`-th Catalan number.

The Catalan numbers are ubiquitous in combinatorics. For example, `combinat::catalan(n)` counts the Dyck words of size `n`, the ordered trees with `n` nodes, the binary trees with `n+1` nodes, the complete binary trees with `2n+1` nodes, the standard tableaux with two rows of size `n`, the triangulations of a regular `n+2`-gone, or the non-crossing partitions of {1, 2, …, n}.

`combinat::catalan(n)` is calculated using the formula

.

## Examples

### Example 1

We compute the first Catalan numbers:

`combinat::catalan(n) \$ n = 0..6`

### Example 2

If one uses a wrong argument, an error message is returned

`combinat::catalan(-1)`
```Error: Invalid object '-1'. Type of argument number 1 must be 'Type::NonNegInt'. Evaluating: combinat::catalan ```

## Parameters

 `n` Nonnegative integer

## Return Values

Positive integer.