There are exactly ten ways of selecting three from five, 12345:
123, 124, 125, 134, 135, 145, 234, 235, 245, and 345
In combinatorics, we use the notation,
In general,
It is not until
How many, not necessarily distinct, values of
The binomial coefficients with fixed
Pascal's rule states that
To avoid having to compute the binomial coefficient from scratch every time, my program uses the helpful identities
def p53():
binom = 1144066
k = 10
res = 0
for n in range(23, 101):
while binom * k // (n-k+1) > 10**6:
binom = binom * k // (n-k+1)
k -= 1
res += n - 2*k + 1
binom = binom * (n+1) // (n-k+1)
return res