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
def odd_composites(): for i in utils.count_from(2): if i % 2 == 1 and len(list(utils.divisors(i))) > 2: yield i
def doubled_squares(): for i in utils.count_from(1): yield 2 * i ** 2
def consecutive_numbers(num_numbers): for i in utils.count_from(2): yield range(i, i + num_numbers)