Created
February 5, 2020 09:26
-
-
Save kosugi/f20b31cb88fe301412dfd05b017f8df6 to your computer and use it in GitHub Desktop.
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 itertools import permutations | |
| f = lambda xs: g(xs[0], xs[1] * 10 + xs[2], xs[3], xs[4] * 10 + xs[5], xs[6], xs[7] * 10 + xs[8]) | |
| g = lambda a, b, c, d, e, f: a * d * f + b * c * f + b * d * e == b * d * f | |
| h = lambda xs: tuple(sorted([(xs[0], xs[1] * xs[2]), (xs[3], xs[4] * xs[5]), (xs[6], xs[7] * xs[8])])) | |
| print(set(map(h, filter(lambda xs: f(xs), permutations(range(1, 10)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment