public static function catalanNumber(int $n) { if ($n < 0) { throw new Exception\OutOfBoundsException('Cannot compute negative catalan number.'); } return 1 / ($n + 1) * self::centralBinomialCoefficient($n); }