8
$\begingroup$

After spending half of the night with important calculations Professor Delvershy arrived late this morning. To his dismay he discovered that one of his students used the unexpected spare time to transform his calculations to modern art:

Fortunately the student always used the same symbol for the same digit. Can you help the Professor to restore his calculations?


Text version for copying:

ABC + DEC = FFA
  -     -     -
 DB + BED = GHI
  =     =     =
JCE + GHJ = EFG
$\endgroup$
2
  • $\begingroup$ Might different letters be the same digits? (if so, then a solution could be A,B,C,D,E,F,G,H,I,J = 0) $\endgroup$ Sep 19, 2015 at 22:36
  • $\begingroup$ @BenFrankel No, every different symbol/letter is a different digit, and numbers can't start with 0. $\endgroup$
    – Sleafar
    Sep 19, 2015 at 22:40

3 Answers 3

7
$\begingroup$

Here's an analytic solution.

From DEC - BED = GHJ, the middle digits imply either H=0 or H=9. From DB + BED = GHI, since B$\neq$G in the hundreds place, there must be a carry from the sum in the middle digits, possibly including a carry from the right digits. That is, D+E(possibly +1)=10+H But since D+E is at most 17 (when {D,E}={8,9}), H cannot be 9, so H=0.

From FFA - GHI = EFG, since H=0, we have the following. $$F-G = E \tag{1}\label{1}$$ $$A-I = G \tag{2}\label{2}$$

From DEC - BED = GHJ, since H=0, we have the following. $$C-D = J \tag{3}\label{3}$$ $$D-B = G \tag{4}\label{4}$$

From JCE + GHJ = EFG, since H=0 (and so F $\neq$ 0), we have the following. $$F = C+1 \tag{5}\label{5}$$ $$E+J = 10+G \tag{6}\label{6}$$ $$J+G = E \tag{7}\label{7}$$

Substituting $E$ from $\eqref{7}$ into $\eqref{6}$, we get J=5.

Substituting $E$ from $\eqref{7}$ into $\eqref{1}$, we get $$F = 5 + 2G \tag{8}\label{8}$$ from which we get 2 possibilities: $(G,F) \in \{(1,7),(2,9)\}$.

Equating $\eqref{5}$ and $\eqref{8}$, we get $$C = 4 + 2G \tag{9}\label{9}$$ from which we get 2 possibilities: $(G,C) \in \{(1,6),(2,8)\}$.

Substituting $D=C-5$ from $\eqref{3}$ into $\eqref{4}$, we get $$B = C - 5 - G \tag{10}\label{10}$$ into which we test the 2 possibilities for $(G,C)$ from $\eqref{9}$ to get $(G,C,B) \in \{(1,6,0), (2,8,1)\}$. Since H=0, we discard the triple with $B=0$. So B=1, C=8 and G=2.

We also get F=9 from $\eqref{8}$, E=7 from $\eqref{1}$, and D=3 from $\eqref{3}$.

This leaves A and I to be matched with 4 and 6. From $\eqref{2}$, we conclude that A=6 and I=4.

Putting it all together, we have ABCDEFGHIJ = 6183792045.

$\endgroup$
5
  • $\begingroup$ I got about 1/2 way through before realizing that I didn't know how to prove H=0. Thank you for taking it to the end and showing me the clean, methodical approach that ought to be taken as opposed to me just scribbling on paper. :) $\endgroup$
    – Warkgnall
    Sep 20, 2015 at 8:05
  • 1
    $\begingroup$ @Warkgnall There is another method to prove that H is 0. The puzzle is using all 10 digits. As numbers don't start with 0, we can rule out ABDEFGJ. From ..C + ..C = ..A we can rule out C. From ..A - ..I = ..G we can rule out I. This leaves only H=0. $\endgroup$
    – Sleafar
    Sep 20, 2015 at 8:28
  • $\begingroup$ @Warkgnall You're welcome. This puzzle was fun to do; it was satisfying to see the 9 remaining variables resolve out of only 7 equations. $\endgroup$
    – Lawrence
    Sep 20, 2015 at 8:29
  • $\begingroup$ @Sleafar This is very true. I guess I just didn't think about it long/hard enough. $\endgroup$
    – Warkgnall
    Sep 20, 2015 at 8:35
  • $\begingroup$ Great explanation! And thanks for teaching me some new MathJax, too! $\eqref{1}$ $\endgroup$ Sep 21, 2015 at 15:18
1
$\begingroup$

The professors calculations were:

618  +  378  =  996
- - -
31 + 173 = 204
= = =
587 + 205 = 792

Or

A: 6
B: 1
C: 8
D: 3
E: 7
F: 9
G: 2
H: 0
I: 4
J: 5

Now I have to admit I bruteforced this solution, the only clever part I did to reduce the permutations from 10! to 9!*3 was to realise that the only characters that don't start at the beginning of a number are CHI and thus are the only candidates for 0 assuming the professor doesn't write with leading zeros.

The code I used to bruteforce this for anyone who is JavaScript inclined is:

var variables = ['A','B','C','D','E','F','G','I','J'];
var assertions = [
  'ABC + DEC == FFA',
  'DB + BED == GHI',
  'JCE + GHJ == EFG',
  'ABC - DB == JCE',
  'DEC - BED == GHJ',
  'FFA - GHI == EFG'
].map(function(assertion) {
  expression = assertion
    .replace(/[A-J]+/g, 'Number($&)')
        .replace(/(?=([A-J])([A-J]))[A-J]/g, '$1+\'\'+')
    .replace(/[A-J]/g,'charMap[\'$&\']');

  return new Function('charMap', 'return ' + expression + ';');
});

function permute(arr, memo) {
  var result
    , cur
    , memo = memo || [];

  for (var i = 0; i < arr.length; i++) {
    cur = arr.splice(i, 1);

    if (arr.length === 0) {
      result = testPermutation(memo.concat(cur));
      if (result) return result;
    }

    result = permute(arr.slice(), memo.concat(cur));
    if (result) return result;

    arr.splice(i, 0, cur[0]);
  }

  return null;
}

function testPermutation(permutation) {
  var charMap = permutation.reduce(function(obj, variable, index) {
    obj[variable] = index + 1;
    return obj;
  }, {
    'H': 0
  });

  return assertions.every(function(assertion) {
    return assertion(charMap);
  }) ? charMap : false;
}

var combination = permute(variables);
console.log(combination);
$\endgroup$
1
  • $\begingroup$ I should have added a no-computers tag. :) $\endgroup$
    – Sleafar
    Sep 20, 2015 at 5:37
1
$\begingroup$

Here's a solution based on constraints, not simultaneous equations. Consider the 3x3 sums:

$$\begin{align} \text{From}\ R_1,&\quad F > A,\quad F > D,\quad A + D < 10,\quad A = 2C \bmod 10\\ \text{From}\ R_2,&\quad G = B+1,\quad D+E > 8,\quad I = B+D \bmod 10\\&\qquad (\text{Partial increasing sequence:}\ BG)\\ \text{From}\ R_3,&\quad E = J+G\qquad (\text{possibly}\ {+1})\\[10pt] \text{From}\ C_1,&\quad J = A-1,\quad D > B\qquad (\text{Partial increasing sequence:}\ JA)\\ \text{From}\ C_2,&\quad D\ (\text{possibly}\ {-1}) - B = G\\&\qquad \hbox{But since $G=B+1$ and $D<10$, we have $B < 4$.}\\ \text{From}\ C_3,&\quad F > E,\quad E = F\ (\text{possibly}\ {-1}) - G, \quad\hbox{$I$ is nonzero (since $A \ne G$)}\\ \text{From}\ C_2,&\quad D\ (\text{possibly}\ {-1}) - B = G\\&\qquad \hbox{But since $G=B+1$ and $D<10$, we have $B < 4$.}\\ \text{From}\ C_3,&\quad F > E,\quad E = F\ (\text{possibly}\ {-1}) - G,\quad \hbox{$I$ is nonzero (since $A \ne G$).} \end{align}$$

Condition $Z$: Assuming leading digits are nonzero, the only digits that might be zero are $C$ and $H$.

From the above, we have the partial sequences:

\begin{array}{lc} S_1: & \dots JA \dots F \dots \\ S_2: & \dots BG \dots D \dots F \dots \\ S_3: & \dots E \dots F \dots \end{array}

$A$ is even ($R_1$), $A+D < 10$ ($R_1$), $D \ge B+2$ ($S_2$), and $B < 4$ ($C_2$). So $JA|BG$ must be one of $\{12|34, 34|12, 56|12\}$.

If $JA|BG = 12|34$, then $C=6$ ($R_1$), $E=5$ ($R_3$), $F=9$ ($C_3$), and $D=7$ ($R_1,Z$). But this makes $I=0$ ($R_2$), violating Condition $Z$. So $JA|BG \ne 12|34$. Also, $JA|BG \ne 34|12$ ($D$ is left with no solution by $C_2$).

So $JA|BG = 56|12$. Since $A+D<10$ ($R_1$) and $D$ is nonzero, we have $D=3$, so $I=4$ ($R_2$). We have:

$$\begin{array}{} 0&1&2&3&4&5&6&7&8&9\\ &B&G&D&I&J&A \end{array}$$

Since $G=2$, $EF=79$ ($C_3$). We also have $A=6$, so $C=8$ ($R_1$). This determines the final digit $H=0$.

Putting this together, we have $$ABCDEFGHIJ = 6183792045$$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.