This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from collections import Counter, namedtuple | |
| def is_prime(i) -> bool: return all(i % p for p in range(2, i)) | |
| def primes(N): return [p for p in range(2, N) if is_prime(p)] | |
| # Set: `ints` are a set of integers that total to `sum`; | |
| # `need` is a Counter of digits that are needed to complete the Set. | |
| Set = namedtuple('Set', 'ints, sum, need') |