mirror of
https://github.com/golang/go
synced 2024-11-26 13:28:27 -07:00
- binomial implementation (fixing broken build)
R=r OCL=18738 CL=18738
This commit is contained in:
parent
175dd773e6
commit
483e031525
@ -841,6 +841,11 @@ export func Fact(n uint) *Natural {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export func Binomial(n, k uint) *Natural {
|
||||||
|
return MulRange(n-k+1, n).Div(MulRange(1, k));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
func (x *Natural) Gcd(y *Natural) *Natural {
|
func (x *Natural) Gcd(y *Natural) *Natural {
|
||||||
// Euclidean algorithm.
|
// Euclidean algorithm.
|
||||||
for !y.IsZero() {
|
for !y.IsZero() {
|
||||||
|
Loading…
Reference in New Issue
Block a user