aoc2017-day15-2

Run Settings
LanguagePython
Language Version
Run Command
from functools import reduce def generate(current, factor, rem, scale=1): while True: current = (current * factor) % rem if current % scale == 0: yield current gen = (1 if (x & 0xFFFF) == (y & 0xFFFF) else 0 for x,y in zip(generate(618,16807,2**31-1,4), generate(814,48271,2**31-1,8))) s = reduce(lambda x,y: x+y,(next(gen) for _ in range(5000000))) print(s)
Editor Settings
Theme
Key bindings
Full width
Lines