The letters $a, b, c, d, e$ and $f$ represent single digits and each letter represents a different digit. They satisfy the following equations: $$ a+b=d, \quad b+c=e \quad \text { and } \quad d+e=f \text {. } $$ Find all possible solutions for the values of $a, b, c, d, e$ and $f$.

This is clearly easily solved by computer, but what is an elegant and hopefully quick way of doing it by hand?


3 Answers 3



Eight possible permutations


By manupulating the equations, we get a+2b+c=f=d+e. This means that the least possible value of f must be 7, since none of the numbers can be zero; however, this means (a,c) belongs to {2,3} and b=1, but it doesn't satisfy e and f. So the only two possibilities for f are 8 and 9.

For f=8, b must be less than 3. For a,c = {1,3}, b=2, we don't have a solution so it is discarded. On to the next solution b=1, a,c={2,4}, we get d,e={3,5} so two solutions from f=8.

For f=9, b must be lesser than 4. For b=3, a,c={1,2} is the only possibility and d,e={4,5} hence it satisfies all equations. For b=2, a,c = {1,4} is the only possibility once again and d,e = {6,3}. This also satisfies all equations. For b=1, we have a,c = {2,5} or {3,4}. But a,c = {3,4} does not satisfy as d,e = {4,5} which has 4 as a common digit. For a,c = {2,5}, we have d,e = {3,6} and it satisfies all the equations.

Hence there are 6 solutions for f=9 and 2 solutions for f=8. Therefore the total number of solutions is 8.

  • $\begingroup$ Maybe I don't understand your notation but how do you get 2 solutions in the second spoiler box? Either a,c={2,4} means a=2 and c=4 and similarly for d,e={3,5} so only one solution or it means {a,c}={2,4} with the two solutions a=2,c=4 and a=4, c=2 and similarly for d and e which gives 4 solutions in total. $\endgroup$
    – quarague
    May 19, 2022 at 6:32
  • $\begingroup$ @quarague Its only exactly two solutions for the second spoiler box. Look at the original equations to see the direct correspondence between a and d. $\endgroup$
    – Nurator
    May 19, 2022 at 6:54
  • $\begingroup$ So you do mean {a,c}={2,4} and {d,e}={3,5} which on its own would give 4 solutions but the original equations give an additional condition so you only have 2 solutions. Maybe extend your explanation a little bit to include that. $\endgroup$
    – quarague
    May 19, 2022 at 6:59
  • $\begingroup$ d,e are governed by a,b and c so for different value of a,b,c there will only one possibility of d and e. I should have elaborated but I tried to keep it concise. $\endgroup$
    – I'm Nobody
    May 19, 2022 at 10:04

Overall, I've counted

Eight solutions

so there will inevitably be some degree of case bashing. This is how I would proceed.

Notice firstly that

None of the digits is zero since that would make some of the others equal or negative.

Suppose $f < 9$

Then either $d$ or $e$ is less than $4$ (since they are distinct). Since both are the sum of distinct digits, it must be that the smaller of the two is $3$ and the other is $4$ or $5$.
Firstly, suppose that this $d=3$. Then $a$ and $b$ must be $1$ and $2$ in some order. Since $e$ must be $4$ or $5$ its clear that $b$ cannot be $2$ (since $c$ would have to be $2$ or $3$) and if $b=1$ then $c=4$ and $e=5$ is the only possible solution. This gives us the first solution $$(a,b,c,d,e,f) = (2,1,4,3,5,8)$$ Since the equations remain the same if we swap $d$ with $e$ and $a$ with $c$, we quickly obtain a second solution which comes from assuming $e=3$ instead $$(a,b,c,d,e,f) = (4,1,2,5,3,8)$$ and these are all the solutions in this branch

Now suppose $f=9$

Then $d$ and $e$ are either $3$ and $6$ or $4$ and $5$, in some order (since we've established that both $d$ and $e$ must be at least $3$).
$d=3$ gives us that $a$ and $b$ are $1$ and $2$ in some order.
With $b=2$ we must have $c=4$ and this gives another solution $$(a,b,c,d,e,f) = (1,2,4,3,6,9)$$ With $b=1$ we must have $c=5$ and we have yet another solution $$(a,b,c,d,e,f) = (2,1,5,3,6,9)$$ Again, we can reverse the role of $(d,e)$ and $(a,c)$ to retrieve the solutions in the $e=3$ branch $$(a,b,c,d,e,f) = (4,2,1,6,3,9)$$ $$(a,b,c,d,e,f) = (5,1,2,6,3,9)$$ Finally, $d=4$ gives us $a$ and $b$ being $1$ and $3$ in some order.
$b=1$ doesn't work because it would mean $c=4=d$.
$b=3$ gives us another solution $$(a,b,c,d,e,f) = (1,3,2,4,5,9)$$ and swapping $(d,e)$ and $(a,c)$ gives us the last solution which comes from the $e=4$ branch $$(a,b,c,d,e,f) = (2,3,1,5,4,9)$$


I just wanted to 'see' what the solutions looked like, but I disqualified myself by using a computer to get the solutions. Anyway, here is a visualization for your amusement.


The nodes of this hypergraph are the possible digit values that occurred in at least one solution. The coloured set covers are the hyperedges. The hyperedges are labelled 0-to-7 for the eight solutions. ![enter image description here


It looks like all solutions cover the set $\{1,2,3\}$. Maybe a simple rule based on these three special choices can be constructed to get what the remaining digits of the solution have to be (i.e. how to pick the remaining $\{4,5,6,8\}$). The number 7 doesn't get to join the party.

Code for Visualization

import hypernetx as hnx
import matplotlib.pyplot as plt
from itertools import permutations

values = set(range(10))

solutions = {}
sol_count = 0
for perm in permutations(values, r=6):
    a,b,c,d,e,f = perm
    if a + b == d:
        if b + c == e:
            if d + e == f:
                solutions[str(sol_count)] = perm
                sol_count += 1
H = hnx.Hypergraph(solutions)

  • $\begingroup$ rot13: Zl pbqr vf cerggl anvir. Bar guvat lbh pbhyq punatr vs lbh jnagrq vg eha zber rssvpvragyl vf gb ercynpr inyhrf = frg(enatr(10)) jvgu inyhrf = frg(enatr(1,10)) - {7} fvapr mreb naq frira ner arire va gur fbyhgvbaf sbe guvf ceboyrz. $\endgroup$
    – Galen
    May 18, 2022 at 20:48

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.