This is machine translation

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

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Catalan numbers

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

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




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



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

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



Nonnegative integer

Return Values

Positive integer.

Was this topic helpful?