MathPHP\Probability\Combinatorics::centralBinomialCoefficient PHP Метод

centralBinomialCoefficient() публичный статический Метод

(2n) (2n)! ( ) = ----- for n ≥ 0 (n ) (n!)² https://en.wikipedia.org/wiki/Central_binomial_coefficient
public static centralBinomialCoefficient ( integer $n ) : integer
$n integer
Результат integer number
    public static function centralBinomialCoefficient(int $n)
    {
        if ($n < 0) {
            throw new Exception\OutOfBoundsException('Cannot compute negative central binomial coefficient.');
        }
        $⟮2n⟯! = self::factorial(2 * $n);
        $⟮n!⟯² = self::factorial($n) ** 2;
        return $⟮2n⟯! / $⟮n!⟯²;
    }