Skip to content

Instantly share code, notes, and snippets.

@md2perpe
Created December 25, 2020 16:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save md2perpe/2df57959c323aa85e83ef0f7f2d41e14 to your computer and use it in GitHub Desktop.
Save md2perpe/2df57959c323aa85e83ef0f7f2d41e14 to your computer and use it in GitHub Desktop.
Solve a specific character addition
# Solve:
# LETA
# +TALL
# =====
# CACHE
for a in range(10):
for e in range(10):
for l in range(10):
for t in range(10):
for c in range(10):
for h in range(10):
if int(f"{l}{e}{t}{a}") + int(f"{t}{a}{l}{l}") == int(f"{c}{a}{c}{h}{e}"):
print(f"{l}{e}{t}{a} + {t}{a}{l}{l} = {c}{a}{c}{h}{e}")
@md2perpe
Copy link
Author

Prints

0000 + 0000 = 00000
8921 + 2188 = 11109
6852 + 5266 = 12118
4783 + 8344 = 13127
2614 + 1422 = 04036
0545 + 4500 = 05045
8476 + 7688 = 16164
6307 + 0766 = 07073
4238 + 3844 = 08082
2169 + 6922 = 09091

@md2perpe
Copy link
Author

Removing solutions where the first character in some number is 0 we only have these solutions:

8921 + 2188 = 11109
6852 + 5266 = 12118
4783 + 8344 = 13127
8476 + 7688 = 16164

If we also remove solutions where several letters stand for the same digit, we only have one solution left:

4783 + 8344 = 13127

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment