|
D.2.3.4 binomial
Procedure from library general.lib (see general_lib).
- Usage:
- binomial(n,k); n,k integers
- Return:
- binomial(n,k); binomial coefficient n choose k
Example:
| LIB "general.lib";
binomial(200,100);""; //type bigint
==> 90548514656103281165404177077484163874504589675413336841320
==>
int n,k = 200,100;
bigint b1 = binomial(n,k);
ring r = 0,x,dp;
poly b2 = coeffs((x+1)^n,x)[k+1,1]; //coefficient of x^k in (x+1)^n
b1-b2; //b1 and b2 should coincide
==> 0
|
|