Created
March 29, 2021 13:02
-
-
Save psqq/a35552d1eff767357d3734ad0b5ffe33 to your computer and use it in GitHub Desktop.
This file contains 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 * | |
ar = range(1, 10) | |
ae = range(1, 6) | |
ash = range(0, 10) | |
ai = range(0, 6) | |
as_ = range(1, 6) | |
al = range(0, 6) | |
an = range(0, 6) | |
all_variants = product(ar, ae, ash, ai, as_, al, an) | |
for r, e, sh, i, s, l, n in all_variants: | |
reshi = 1000 * r + 100 * e + 10 * sh + i | |
esli = 1000 * e + 100 * s + 10 * l + i | |
silen = 10000 * s + 1000 * i + 100 * l + 10 * e + n | |
if reshi + esli == silen and len(set([r, e, sh, i, s, l, n])) == 7: | |
print(f"{reshi} + {esli} = {silen}") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment