import itertools


def generate_masks(num_digits):
    """Generates a mask array, of digits that will be replaced (0 bound). At least 2 masked but does not include the last digit as unlikely to get > 5 primes
    For example generate_masks(4) returns [[0, 1], [0, 2], [1, 2], [0, 1, 2]]
    """
    # Generate masks (not the last number) for each digit
    masks = []

    for i in range(2, num_digits):
        masks.extend(itertools.combinations(range(0, num_digits - 1), i))

    return masks