Beispiel #1
0
def dl_prod(i, j):
    """
    Return the product of 4 consecutive diagonal entries in the grid starting at
    (i, j) and moving down-left. 'i' indexes rows and 'j' indexes colums, from
    the top-left of the grid.
    """
    if j < 3 or i > 16:
        return -1
    else:
        return product(GRID[i+k][j-k] for k in range(4))
Beispiel #2
0
def h_prod(i, j):
    """
    Return the product of 4 consecutive horizontal entries in the grid starting
    at (i, j) and moving right. 'i' indexes rows and 'j' indexes colums, from
    the top-left of the grid.
    """
    if j > 16:
        return -1
    else:
        return product(GRID[i][j+k] for k in range(4))
Beispiel #3
0
def num_divisors(n):
    p_factors = Counter(prime_factors_large_n(n))
    p_factors.update(p_factors.keys())  # Add '1' to every Counter entry
    return product(p_factors.values())
Beispiel #4
0
def solve():
    return sum(int(digit) for digit in str(product(range(1, 101))))