Extracted from Pike v7.8 release 866 at 2016-11-06.
pike.ida.liu.se
[Top]
Gmp
Gmp.mpz

Method Gmp.mpz()->bin()


Method bin

Gmp.mpz bin(int k)

Description

Return the binomial coefficient n over k , where n is the value of this mpz object. Negative values of n are supported using the identity

(-n)->bin(k) == (-1)->pow(k) * (n+k-1)->bin(k)

(See Knuth volume 1, section 1.2.6 part G.)

Throws

The k value can't be arbitrarily large. An error is thrown if it's too large.

Note

This function is currently (Pike 7.8) not available with old releases of the gmp libraries.