Function: bincoeff( N, K )
- Return the binomial coefficient of N and K.
- The coefficient of the x^k term in the polynomial expansion of the binomial power (1 + x)^n.
- C( N, K ) = N! / K! (N-K)!
Example:
octave:1> bincoeff( 5, 2 )
ans =
10
octave:2>
Appendix:
- Pascal's Triangle
| (N,K) | | 0 | 1 | 2 | 3 | 4 |
| | 0 | 1 | 1 | 1 | 1 | 1 |
| | 1 | | 1 | 2 | 3 | 4 |
| | 2 | | | 1 | 3 | 6 |
| | 3 | | | | 1 | 4 |
| | 4 | | | | | 1 |
See Also:
|