nCk(n,k)

Version 1.0.0.0 (830 Bytes) by Eyal Ben-Hur
Vectorized version of nchoosek function for multiple k's
33 Downloads
Updated 30 Jan 2017

View License

Returns the Binomial coefficient for each element in k for a given scalar n.
k may have any shape.
n must be scalar.
Example:
k = [4 5 6];
n = 10;
C = nCk(n,k)

C =
210 252 210

Cite As

Eyal Ben-Hur (2026). nCk(n,k) (https://www.mathworks.com/matlabcentral/fileexchange/61348-nck-n-k), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2011a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Constants and Test Matrices in Help Center and MATLAB Answers
Version Published Release Notes
1.0.0.0

Added an example