# Addition table with hidden digits

Similar to the previous puzzle, find the values behind the letters.

     T , E , M , A
K , A , K , A
+    S , A , F , T
-------------------
F , E , S , T , A


These are roughly the Swedish words for theme, cookie, soda, and the result, partying. All letters correspond to different digits, and leading digits in numbers are non-zero.

Below is a second puzzle of this type:

    A , N , A , N , A , S
M , A , T , O , S , T
T , O , M , A , T
+           S , A , L , T
-------------------------------
S , A , L , L , A , D


The words are pineapple, cheese, tomato, salt with the total salad.

The solutions are unique.

Human unfriendly way to solve first puzzle.

Let we call each carry digits c1 to c4.

We have:
[0]: 0 <= c1, c2, c3, c4 <= 2
[1]: A+A+T=c1*10+A
[2]: M+K+F+c1=T+c2*10
[3]: E+A+A+c2=S+c3*10
[4]: T+K+S+c3=E+c4*10; T<>0; K<>0; S<>0
[5]: F=c4; F<>0

----

[1] -> A+T=c1*10
-> [6]: c1=1;
-> [7]: A+T=10; A<>0; T<>0

---

[4] + [3] -> T+K+(E+A+A+c2-c3*10)+c3=E+c4*10
-> T+K+A+A+c2=c4*10+c3*9
+ [2] -> (M+K+F+1-c2*10)+K+A+A+c2=c4*10+c3*9
-> [8]: M+K+K+A+A+1=(c4+c2+c3)*9

[9]: 12 = 4+1+1+3+3 <= M+K+K+A+A <= 7+8+8+9+9 = 41
+ [8] -> 12 <= 9*(c2+c3+c4) <= 42
-> [10]: 2<=c2+c3+c4<=4

[4] + [6] + [2] -> (M+K+F+1-c2*10)+K+S+c3=E+c4*10
+ [5] -> [11]: M+K+K+S+1+c3+c4-E=(c2+c4)*10

K<>F=c4; K<>0
M+K+K+S+1+c3+c4-E<=7+8+9+9+1+2+2-0=38
-> (c2+c4)*10<=37
-> [12]: c2+c4<=3

----

Consider c2=2;
[2]: M+K+F+1=T+c2*10>=1+2*10=21
-> M+K+F>=20
-> M+K>=20-F
+ [0] -> M+K>=18
M, K cannot both be 9 (impossible)
-> [13]: c2<>2

----

-> [8]: M+K+K+A+A+1=(c4+c2+c3)*9
-> [7]: A+T=10; A<>0; T<>0
[2]: M+K+F+1=T+c2*10

[2] + [8] + [7] -> M+K=(10-A)+c2*10-1-c4=10+c2*10-A-1-c4
-> M+K+K=9*c2+9*c3+9*c4-1-A-A
-> [14]: A+K=9*c3+10*c4-c2-10
-> [15]: 14<=9c3+10c4-c2<=27

----

[2] + [3] + [4]
-> (E+A+A+c2)+(T+K+S+c3)+(T+c2*10)=(M+K+F+c1)+(S+c3*10)+(E+c4*10)
-> c2*11+20=M+F+1+c3*9+c4*10
-> [16]: M=19+c2*11-c3*9-c4*11
-> 10<=-c2*11+c3*9+c4*11<=19
-> 10<=11*(c3+c4-c2)-2*c3<=19
-> 10<=11*(c3+c4-c2)<=23
-> c3+c4-c2=1 or (c3=2 and c2=c4=1)
If (c3=2, c2=c4=1) -> M=1=F (impossible)
-> c3+c4-c2=1

---

[10] + [12] + [13] + [15] + [17]
-> [17]: (c2, c3, c4) may be (1, 0, 2) or (1, 1, 1)
-> [18]: c2+c3+c4=3
-> [19]: c2=1
-> [20]: c3+c4=2

+ [8]
-> [21]: M+K+K+A+A=26

[14] -> [22]: A+K=7+c4
[16] -> [23]: M+F=12-c4

[21] + [22]
-> M=12-c4*2
-> [24]: F=c4=2
-> [25]: M=8
-> [26]: c3=0
-> [27]: A+K=9; K=T-1

[3] -> [28]: E+A+A+1=S

[27] + [7] + [28] + [25] + [24]:
(A, T, K, E, S, M, F) = (4, 6, 5, 0, 9, 8, 2)

Attempting a Human friendly way to solve as requested by @Per Alexandersson. Work in progress: Puzzle 1:

F can only be 1 or 2 Reason: overflow digit of addition of 3 numbers.

considering @tsh suggestion

A + T = 10 Reason: A+A+T = A , so A+T should be 10 and the answer will be A+A+T = 1A (1 carried over).

Which implies:

1. A, T cannot be 0 , since if A = 0 , T = 10 vice versa. 2. A, T cannot be 5. Since A+T = 10 , A = 5 then T = 5. But A,T are different numbers(i hope).

• "A and T are either both odd or both even" -> Why not just A+T=10.
– tsh
Nov 22, 2020 at 12:25
• @tsh Oh i realise you are right, A+T = 10 and neither A nor T can be 5. Does that sound better ?! Nov 22, 2020 at 12:30

From my previous answer, we can find the answers with brute force:

from itertools import permutations

for comb in permutations([1, 2, 3, 4, 5, 6, 7, 8, 9, 0], 7):
a, e, f, k, m, s, t = comb
if all([t, k, s, f]):
if int(f'{t}{e}{m}{a}') + int(f'{k}{a}{k}{a}') + int(f'{s}{a}{f}{t}') == int(f'{f}{e}{s}{t}{a}'):
print('a e f k m s t')
print(a, e, f, k, m, s, t)
print('---------------')
for comb in permutations([1, 2, 3, 4, 5, 6, 7, 8, 9, 0], 8):
a, d, l, m, n, o, s, t = comb
if all([t, k, s, f]):
if int(f'{a}{n}{a}{n}{a}{s}') + int(f'{m}{a}{t}{o}{s}{t}') + int(f'{t}{o}{m}{a}{t}') + int(f'{s}{a}{l}{t}') == int(f'{s}{a}{l}{l}{a}{d}'):
print('a d l m n o s t')
print(a, d, l, m, n, o, s, t)

Output:


a e f k m s t
4 0 2 5 8 9 6
---------------
a d l m n o s t
1 9 2 3 0 7 5 8

• Thats more or less how I came up with them. Are there human-friendly steps to solve them? Nov 22, 2020 at 7:54
• I have done a sketch of how to do it but writing it all out would be incredibly tedious.
– PDT
Nov 22, 2020 at 11:31
• @PerAlexandersson Yep. I'm sticking to my root, though. Nov 22, 2020 at 12:48