Rebecca (@edutinker) asks for methods for solving these puzzles
@shahlock Can you post methods for solving your puzzles? Mine are not working 😤 pic.twitter.com/NP3I8zUJ6Z
— Rebecca ; ❤💯 (@edutinker) February 25, 2017
Here’s my approach using $$\sqrt{\mbox{RESPECT}} = \mbox{MATH}$$
The basic idea is that we want to reduce the search space as much as possible before we have to resort to a trial and error approach. The sooner we go to trial and error the more tedious the puzzle is. Naturally, we’ll look for deterministic ways to reduce the search space.
First, we can recognize that \((\mbox{MATH})^{2} = \mbox{RESPECT}\)
Next, we can see that if we can lock down H, then we can get T and C for free. Since one of the constraints is that the mapping between letters and digits has to be one-to-one, we can see that the only possibilities for H are $$H = \{2,3,4,7,8,9\}$$
For example, if \(H = 5\), then \(H \times H = 25\) which implies \(T = 5\), which is disallowed. Now, given the restricted values on \(H\), we have this list of \((H, T, C)\) triplets.
$$\begin{align}
H, T, C & = \{(9,1,6), (2,4,6), \\
& (8,4,0), (4,6,9),\\
& (3,9,4), (7,9,0)\}
\end{align}$$
What’s nice is that we have only six cases to explore when we try to figure out how to lock down \(M\) and \(A\).
A next thing to recognize is that \(\mbox{RESPECT}\) means that we have a seven-digit number. At minimum this will be \(1023045\) and at maximum this will be \(9876854\). Taking square roots means that the range of number is between \(1012\) and \(3143\). Thus, since we can’t have a number with leading zeros, \(M = \{1,2,3\}\). Of course, \(R\) can’t be zero. Therefore, its range is from \(1-9\).
Now, all four-digit numbers less than or equal to \(1414\) will yield a seven-digit number that has \(R = 1\). Therefore, those numbers are not admissible. Next, let’s get a range of values for each possibility of \(R\). I’ll use \(x\) as a generic placeholder for the four-digit number we’re searching for.
$$\begin{align}
R = 2 &\implies 1415 \leq x \leq 1732 \\
R = 3 &\implies 1733 \leq x \leq 1999 \\
R = 4 &\implies 2000 \leq x \leq 2236 \\
R = 5 &\implies 2237 \leq x \leq 2449 \\
R = 6 &\implies 2450 \leq x \leq 2645 \\
R = 7 &\implies 2646 \leq x \leq 2828 \\
R = 8 &\implies 2829 \leq x \leq 2999 \\
R = 9 &\implies 3000 \leq x \leq 3143 \\
\end{align}$$
Now, let’s enumerate the valid possibilities for \(\mbox{MATH}\). This is based from the restrictions above.
2019, 2319, 2419, 2819, 1742, 1842, 1942, 3042, 3142, 1548, 1648, 1748, 1948, 2348, 2548, 2648, 3148, 1564, 1764, 1864, 2164, 2364, 3064, 1593, 1693, 2593, 2693, 1497, 1597, 1697, 1897, 2197, 2397, 2497, 2597
Our search space for the puzzle has been reduced down to 35 candidates.
Notice, that I’ve omitted possibilities like \(2064\) since that gives \(R = 4\) violating the one-to-one constraint between letters and digits.
The next thing we can do is a little bit of multiplication per candidate.
Let’s look at \(2019 \times 2019\). We already know that this number ends in \(61\) with a carry of two for the hundreds place and the leading digit is \(4\). The hundreds place is \(2\cdot A\cdot H + T\cdot T + \mbox{carry}\). For \(2019 \times 2019\) we can see that the hundreds place equals \(3\) with a carry of zero. Thus, we haven’t yet reached a contradiction. The thousands place is \(2\cdot M \cdot H + 2\cdot A \cdot T + \mbox{carry}\). For \(2019\) this is \(36\) which means a carry of \(3\) into the ten thousands place and a \(6\) for the thousands place — a violation of the one-to-one constraint. Therefore, \(2019\) doesn’t work and we don’t need to continue with the multiplication.
Doing this for each candidate shows that the solution is \(\mbox{MATH} = 1548\) and \(\mbox{RESPECT} = 2396304\). The ordering I gave would find the solution on the 10th candidate and that’s not too bad.
Were you able to further reduce the search space or did you have a different approach? Did you find this approach helpful? Leave a comment!