Problem 52

Combinatoric selections

Problem 54

Combinatoric selections

Problem 53

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, , where , , and .
It is not until , that a value exceeds one-million: .
How many, not necessarily distinct, values of for , are greater than one-million?
def run():
    total = 0

    n = 23
    r = 10
    value = 1144066

    while n <= 100:
        while value > 1e6:
            r -= 1
            prev = value
            value = value * (r + 1) / (n - r)
        value = prev
        r += 1
        total += (n - r) - r + 1  # e.g. 23C10 ... 23C13
        n += 1
        value = value * n / (n - r)

    return total