nCk(n,k)

Vectorized version of nchoosek function for multiple k's

You are now following this Submission

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://uk.mathworks.com/matlabcentral/fileexchange/61348-nck-n-k), MATLAB Central File Exchange. Retrieved .

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.0.0.0

Added an example