Example #1
0
def problem053(n_min, n_max, ncr_min):
    counter = 0
    for n in range(n_min, n_max + 1):
        for r in range(1, n + 1):
            x = ncr(n, r)
            if x > ncr_min:
                counter += 1
    return counter
Example #2
0
def problem015(n):
    """
    The grid is a directed graph where all vertical lines have direction
    down and all horisontal lines have direction right.

    After quite a bit of staring on paper, i noticed the following:
    If you place the tip of Pascal's triangle in the destination node, the
    number at each node indicates how many possible paths from there to the
    destination. In other words, the number in the start node is the answer.
    """

    return ncr(n * 2, n)