Skip to main content

catalan

Function catalan 

Source
pub fn catalan(n: u64) -> Result<u128, CatalanError>
Expand description

Returns the nth Catalan number using checked u128 arithmetic.

§Errors

Returns CatalanError::CatalanOverflow when the result no longer fits in u128.

§Examples

use use_catalan::catalan;

assert_eq!(catalan(4)?, 14);