Beispiel #1
0
def solve_challenge_b(data):
    scanners = parse_data(data)

    for delay in count_from(0):
        caught = False
        for depth, scanner_range in scanners.items():
            if is_caught(depth, scanner_range, delay):
                caught = True

        if not caught:
            return delay
Beispiel #2
0
def odd_composites():
    for i in utils.count_from(2):
        if i % 2 == 1 and len(list(utils.divisors(i))) > 2:
            yield i
Beispiel #3
0
def doubled_squares():
    for i in utils.count_from(1):
        yield 2 * i ** 2
Beispiel #4
0
def consecutive_numbers(num_numbers):
    for i in utils.count_from(2):
        yield range(i, i +  num_numbers)