Skip to content

Instantly share code, notes, and snippets.

@leshikus
Created April 30, 2024 08:42
Show Gist options
  • Save leshikus/0a49d411bfb85d84d9a6d892b49b1871 to your computer and use it in GitHub Desktop.
Save leshikus/0a49d411bfb85d84d9a6d892b49b1871 to your computer and use it in GitHub Desktop.
Solve munhen = ayti * chat
#!/usr/bin/python3
for m in range(1, 10):
su = set(range(0, 10)) - { m }
for u in su:
sn = su - { u }
for n in sn:
sh = sn - { n }
for h in sh:
se = sh - { h }
for e in se:
munhen = m * 100000 + u * 10000 + n * 1001 + h * 100 + e * 10
sc = se - { e }
for c in sc:
if c == 0: continue
sa = sc - { c }
for a in sa:
st = sa - { a }
for t in st:
cat = c * 100 + a * 10 + t
if munhen % cat != 0: continue
ayti = munhen // cat
if ayti // 1000 != a: continue
i = ayti % 10
si = st - { t }
if not i in si: continue
ayt = ayti // 10
tt = ayt % 10
if tt != t: continue
#print(munhen, ayti, cat)
sy = si - { i }
ay = ayt // 10
y = ay % 10
#if not y in sy: continue
print(munhen, ayti, cat)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment