# Cryptographical Tutorial for eLitmus

##### Basic Rules
• Alphabets can take up only one distinct value.
• Alphabets can only take up values between 0-9.
• Decoded numbers can’t begin with 0, for example, 0813.
• Problems are uni-solutional.
• 19 is the max value with a carryover for two one-digit number in the same column.
• Carry over can only be 1.
• Be patient there is no specific rule, you will only learn how to solve when you see examples.
Practice questions after finishing Rules and Hacks here
##### Hacks
• If A + B = A then the possible value of B=0 or 9
```        5  6
+ 9  7          <- Example for 9
1  5  3```
• Numbers can’t begin with 0 in the below example G or B ≠0.
`      09841 makes no sense => 9841`
• All values are unique thus for e.g in below example G=1 thus B, A, S, E, L, M ≠ 1
• Values are distinct thus for e.g. if G=1 then if at a later point in time you get G=2 you’re solving wrongly.
• If X * X = _X. Therefore – A={1, 5, 6}
```      Since only,
1*1 = _1
5*5 = _5
6*6 = _6
```
• If P x  Q= _ P
• then possible values of P and Q, then P = 5 and Q = 3, 7, 9.
• When P = 2, 4, 8 and Q = 6
```-     P x Q = _P
5 x 3 = _5 i.e 15
5 x 7 = _5 i.e 35
5 x 9 = _5 i.e 45```
```-     P x Q = _P
2 x 6 = _ 2 i.e 12
4 x 6 = _ 4 i.e 24
8 x 6 = _ 8 i.e 48```
##### Example
• Suggestion – Use Pen and Paper to learn from the example it might take more than 30 mins to understand this but when you get the logic, you’ll be able to solve any problem within very less time.
```  BASE
+BALL
------------
GAMES
------------```
=> Since, Maximum Carryover = 1
=> G = 1
Now Considering only the unit digits and tens digit
```  SE
+LL
-------
ES
-------```
=> S+L = E – (i) or S+L = 10 + E(Where 1 is carry) – (ii)
=> Similary E + L = S – (iii) or E + L = 10 + S(Where 1 is carry) – (iv)
=> E = S – L or E = S – L + 10(using this)
=> Putting value of E in S + L = E => S + L = S – L + 10
=> 2L = 10 => L = 5
=>  from equation (iii) E + L = S => S – E = L = 5
=> This gives us possible values for (S,E) as (0,5), (1,6), (2,7), (3,8) and (4,9) or (E,S) if we take equation (i)
But out of these (0,5) and (1,6) cannot be accepted as G=1 and L=5.(Alphabets can only have distinct values)
So we are left with the possibilities of (2,7) , (3,8) and (4,9). We can also infer that of S and E , E is the smaller value and S is the larger.because if E were larger, we would have a carry and then S+L=E would not be valid. This means that S+L=E has a carry over of 1.
use the trial and error method substituting values for the letters keeping all the above points in mind.
Let us assume E=2 and S=7 and B=6. So we have,
``` 1
6A72
+6A55
-----------
1AM27
------------```
Now A can be either 2 or 3 depending on whether we have a carry from A+A or not. But since E=2, that means A must be 3 and therefore there is a carry. But replacing the other A’s in the equation with 2’s gives us two contradictions.
Firstly M shall become equal to 7 (S is already equal to 7) and A+A does not produce a carry. Therefore our assumptions were wrong and we will have to try again for different values.
(I shall skip to the combination which yields the solution, but you shall have to try for all possible values in between)
Now let us try for E=3 and S=8 and B=7. We have,
``` 1
7A83
+7A55
----------
1AM38
-----------```
This gives us A=4 or 5 based on whether there is a carry or not, but since already L=5, A must be equal to 4, therefore M=9. We have obtained values for all unknowns without any contradictions and hence this is the solution)
So finally we have
``` 1
7483
+7455
---------
14938
---------```
Therefore,
G=1
E=3
A=4
L=5
B=7
S=8
M=9