6 kyu

Readable N choose K

Description:

In mathematics, any of the positive integers that occurs as a coefficient in the binomial theorem is a binomial coefficient. Article.

Commonly, a binomial coefficient is indexed by a pair of integers n >= k >= 0 and is written (n 'over' k). This notation is read as "from n choose k".

The formula is described simply, here.

An interesting fact about the binomial theorem is that the binomial coefficients can be arranged to form Pascal's triangle. They can also be used to describe properties of N dimensional hypercubes. Here's a cool video talking about that.

Challenge

Your task is to augment the Integer class to give integers a choose method so that you may write 10.choose 4 and return the number of combinations. e.g. 10.choose(4) == 210. You will find enough information to solve this challenge in the links above.

Combinatorics
Mathematics
Algorithms

More By Author:

Check out these other kata created by DiegoSalazar

Stats:

CreatedJun 6, 2017
PublishedJun 6, 2017
Warriors Trained236
Total Skips42
Total Code Submissions144
Total Times Completed88
Ruby Completions88
Total Stars2
% of votes with a positive feedback rating95% of 30
Total "Very Satisfied" Votes27
Total "Somewhat Satisfied" Votes3
Total "Not Satisfied" Votes0
Total Rank Assessments6
Average Assessed Rank
6 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • DiegoSalazar Avatar
  • tachyonlabs Avatar
Ad