My niece asked me to help her with a problem, since she and her parents couldn't figure it out.

The question was: abcde - fghi = 42137

with a-i being 1-9 (so for example 12345 - 6789), with each digit appearing once.

I had no idea how to do this intelligently, and wrote some code which brute-forced through all permutations of 1-9 and give me the results ((43726, 1589),(43789, 1652),(47326, 5189),(47398, 5261)).

How would I go about this as a 9 year old student who cannot code this? Just trial and error? All we could really say is that the first digit is a 4 or 5, but thats it, aside from that it was just trying, and at some point I was so pissed with that task I wrote code to deal with it.

If $abcde-fghi=42137$, then (supposing no carrying operations are expected of the student) $e$ and $i$ must be either $8$ and $1$ or $9$ and $2$. Suppose they are $9$ and $2$. Then we have $\{1,3,4,5,6,7,8\}$ remaining.
Then $a$ must be $4$ as we've used the $9$. Remaining: $\{1,3,5,6,7,8\}$.
Now we can use $8$ and $5$ in the spots of $d$ and $h$ to make $3$. Remaining: $\{1,3,6,7\}$.
Now we can use $7$ and $6$ for $c$ and $g$ to make $1$. Remaining: $\{1,3\}$.
And obviously, we can use $3$ and $1$ for $b$ and $f$ to make $2$.

So we have $43789 - 1652 = 42137$.

We got here more or less deductively from the initial assumptions --- the total number of 'guesses' I had to take was actually only two --- I guessed that we need to use $9$ and $2$ to make $7$ as opposed to $8$ and $1$, and I guessed the order in which I had to proceed. Note that there aren't that many integer combinations in this puzzle anyway.

It is, however, not a good problem --- if you really think about it and begin to consider the possibility of carrying operations being necessary, then it becomes much more intimidating. I don't think this is pedagogically useful in teaching math --- if anything, it teaches the student a haphazard trial-and-error approach, instead of cementing the foundations of deductive argument.

• In Japan, the 12 years of education is divided into 2 levels (6+6). After the first 6 years, they are required to take a public exam so that they can switch to a better school if they score high. This is the type of questions that will be asked. In other words, this question is a bit harder for a 3rd grader and actually should not even be asked as indicated by the comment above. – Mick Jan 21 '14 at 4:21
• My thoughts on this was that it doesn't really promote logical thinking but doing trial-and-error. I already told her that I consider that a really dumb problem. Thanks for the help, it shows to me there was no real "formula" to solve this, but to assume no carrying, and just go from there (granted that is something I didn't do when I tried to solve it) – SinisterMJ Jan 21 '14 at 9:24