Algebra Precalculus – Christmas Cryptarithm: \”HERES+MERRY+XMAS=READER\”

algebra-precalculusalternative-proofcryptarithmdecimal-expansionpuzzle

I got this puzzle from some others:

\begin{array}{c c c c c c}&\mathrm H&\mathrm E&\mathrm R&\mathrm E&\mathrm S\\&\mathrm M&\mathrm E&\mathrm R&\mathrm R&\mathrm Y\\+&&\mathrm X&\mathrm M&\mathrm A&\mathrm S\\\hline\mathrm R&\mathrm E&\mathrm A&\mathrm D&\mathrm E&\mathrm R\end{array}

Find the letters such that every letter is a distinct digit, and that there are no leading $0$'s.

We only managed to solve this by breaking it down to some cases and then simply brute forcing it. Is there any way to do this without brute force though?


Answer:

$\mathrm{(A, D, E, H, M, R, S, X, Y)} = (8, 0, 4, 6, 7, 1, 3, 9, 5)$

Code: Try it online


Breakdown of what we managed to get:

We started by noting $\mathrm R$ was either $1$ or $2$.

From the rightmost column, $\mathrm{Y = (R – 2S) \% 10}$.

From the next column, $\mathrm{A = 10 – R – \lfloor 2S+Y \rfloor}$, where the last bit is from a carry digit.

From the next column, $\mathrm{D = (M + 2R + 1) \% 10}$. The $1$ comes from a guaranteed carry digit from the previous column.

From the next column, $\mathrm{X = (A – 2E – \lfloor (M+2R+1)/10 \rfloor) \% 10}$, which also uses a carry.

And from the leftmost column, $\mathrm{H = 10 + E – M – \lfloor (2E+x)/10 \rfloor}$.

Enumerating all such possible values for $\mathrm{R,S,M,E}$, and checking each one, results in the above answer.

Best Answer

$$2S+Y=1+10\alpha$$ $$A+R+\alpha=10$$ $$M+2R+1=D+10\gamma$$ $$2E+X+\gamma=A+10\epsilon$$ $$H+M+\epsilon=10R+E$$ $\alpha,\gamma,\epsilon \le 2$ and, since $R\ne 0$, $R$ must be $1$. From $2S+Y=1+10\alpha$ we have $\alpha=2$ and therefore $A=7$ or $\alpha=1$ and therefore $A=8$. We will deal with these possibilities separately.

If $(A,R)=(7,1)$ and $(S,Y)=(9,3),(8,5)\text { or }(6,9).$

$$(1) M+3=D+10\gamma$$ $$(2) 2E+X+\gamma=7+10\epsilon$$ $$(3) H+M+\epsilon=10+E$$

The case $\epsilon=\gamma=0$

From (2) we have $(E,X)=(2,3).$ From (3)-(1) we have $\{D,H\}=\{6,9\}.$ Then $M=D-3= \text{3 or 6}$, a contradiction.

The case $\epsilon=0,\gamma=1$

From $M=D+7$, we have $(D,M)=(2,9).$ Then $X$ cannot be $0$ and so $2E+X=6$ gives $(E,X)=(0,6).$ Then $H=1+E=1$, a contradiction.

If $\epsilon\ne 0$

Adding equations (2) and (3), $E+H+M+X+\gamma=17+9\epsilon\ge 26$. However, $E+H+M+X\le 9+6+5+4=24$ and $\gamma\le1$ so this is impossible.

If $(A,R)=(8,1)$ and $(S,Y)=(4,3),(3,5)\text { or }(2,7).$

$$(1) M+3=D+10\gamma$$ $$(2) 2E+X+\gamma=8+10\epsilon$$ $$(3) H+M+\epsilon=10+E$$

The case $\epsilon=\gamma=0$

From (2) we have $(E,X)=(4,0)\text { or }(2,4).$ From (3)-(1) we have $E=2,\{D,H\}=\{6,9\}.$ Then$(S,Y)=(3,5)$ and $M=D-3= \text{3 or 6}$, a contradiction.

The case $\epsilon=0,\gamma=1$

From $M=D+7$, we have $(D,M)=(0,7) \text { or } (2,9).$ Then $(S,Y)=(4,3)\text{ or } (3,5).$ Then $0$ and $3$ are already assigned and so $2E+X=7$ gives $(E,X)=(0,7).$ Then $H+M=10$ and $H=1$ or $3$, a contradiction.

If $\epsilon\ne 0$

Adding equations (2) and (3), $E+H+M+X+\gamma=18+9\epsilon$. Therefore $\epsilon=1$.

Since $8$ is already assigned either $$\{E,H,M,X\}=\{9,7,6,5\},\gamma=0 \text { or } \{E,H,M,X\}=\{9,7,6,4\},\gamma=1. $$ In the first case, $2E+X=18$ and $X$ is even, then $X=6$ and $E=X$, a contradiction.

In the second case, $2E+X=17$ and $X$ is odd, then

$X=9,E=4,M=D+7$. Therefore $D=0,H=6,M=7.$ Finally, the only possibility for $S$ and $Y$ is $S=3,Y=5$.