Choose(n, i) returning incorrect value
GoogleCodeExporter opened this issue · comments
What steps will reproduce the problem?
Run Choose(3, 2)
What is the expected output? What do you see instead?
Expected: (3 choose 2) = 3
Actual: 6
Please provide any additional information below.
This bug can be solved by changing line #152 in the choose.go file from:
return PartialFactInt(n, smaller) / FactInt(smaller)
to:
return PartialFactInt(n, smaller) / FactInt(n-smaller)
Original issue reported on code.google.com by nickabeg...@gmail.com
on 18 Nov 2013 at 8:55