What is the Julia function to count combinations (n choose k)?——计算组合的数量

从n个元素中取出k个的组合数量:

julia> binomial(2,1)
2

julia> binomial(3,2)
3

具体的组合明细:

julia> using Combinatorics

julia> collect(combinations(1:3,2))
3-element Array{Array{Int64,1},1}:
 [1, 2]
 [1, 3]
 [2, 3]

你可能感兴趣的:(What is the Julia function to count combinations (n choose k)?——计算组合的数量)