# Questions which arose from "A digit reversal"

Last week, I set the following problem - A digit reversal, which confused many people (esp if you read the solutions). A high proportion of people first gave an answer of around 960. Many even claimed that 959 is the correct answer, and gave the following justification:

Since $$T^2 - S^2 = (T-S) (T+S)$$, we can check that the last three digits of $$T+S$$ are 421 and the last three digits of $$T-S$$ are 779. Hence, the last three digits of $$T^2 - S^2$$ are obtained from $$(T+S) \times (T-S) = 421 \times 779 = 327959$$. Thus the answer is 959.

What is wrong with the above solution? What was the wrong assumption / misconception that was made?

(Note that I am not asking for your solutions; you can view the solution discussion for different approaches.)

Here are some questions to guide you.
1. What is the remainder when 123 is divided by 1000?
2. What is the remainder when -123 is divided by 1000?
3.  What are the last three digits of 123?
4. What are the last three digits of -123?
5. What is $$123 \pmod{1000}$$?
6. What is $$-123 \pmod{1000}$$?

Note by Calvin Lin
4 years, 9 months ago

MarkdownAppears as
*italics* or _italics_ italics
**bold** or __bold__ bold
- bulleted- list
• bulleted
• list
1. numbered2. list
1. numbered
2. list
Note: you must add a full line of space before and after lists for them to show up correctly
paragraph 1paragraph 2

paragraph 1

paragraph 2

[example link](https://brilliant.org)example link
> This is a quote
This is a quote
    # I indented these lines
# 4 spaces, and now they show
# up as a code block.

print "hello world"
# I indented these lines
# 4 spaces, and now they show
# up as a code block.

print "hello world"
MathAppears as
Remember to wrap math in $$...$$ or $...$ to ensure proper formatting.
2 \times 3 $$2 \times 3$$
2^{34} $$2^{34}$$
a_{i-1} $$a_{i-1}$$
\frac{2}{3} $$\frac{2}{3}$$
\sqrt{2} $$\sqrt{2}$$
\sum_{i=1}^3 $$\sum_{i=1}^3$$
\sin \theta $$\sin \theta$$
\boxed{123} $$\boxed{123}$$

Sort by:

I'm confused, how does one even get $$T - S$$ = 779? If you consider the numbers $$\pmod {1000}$$ then you get $$T = 321, S = 100$$ thus $$T - S = 221$$ and $$T + S = 421$$? I'm confused as to how you can even get 779 as an answer (I realize it's $$-221 \pmod {1000}$$ but I still don't know how you would get that). I'm probably missing something obvious.

As for the solution you posted, the problem is that $$T^2 - S^2$$ is negative, thus even though the last 3 digits of it are $$959$$, $$-959 \equiv 41 \pmod {1000}$$.

- 4 years, 9 months ago

Great, that is one of the strange aspects of this problem.

When trying to determine the last 3 digits of a number, you need to look at several of the last values. I believe that they looked at the last few digits, namely $$4321 - 9100 = - 4779$$ or $$54321 - 99100 = -44779$$, to 'conclude' that it must be 779.

I'm not commenting if 779 is indeed the last 3 digits, merely on my interpretation of the writeup.

Staff - 4 years, 9 months ago

The idea behind keeping the last 3 digits is to find the remainder after dividing by 1000, i.e. mod 1000. However the last 3 digits are not (mod 1000) for negative numbers.

(T+S) is positive, so its (mod 1000) is the same as its last 3 digits, 421.

(T-S) is negative, so its (mod 1000) is not the same as its last 3 digits but rather 1000 - 779 = 221.

Continuing with the method we get:

$$421\times 221=93041$$ with last 3 digits 41.

- 4 years, 9 months ago

But $$S^2$$ is divided evenly by $$1000$$ (you can stretch that to $$10,000$$, since $$100$$ divides $$S$$, but that is unneccesary), so we really only need the remainder of $$T^2$$, which is easily checked to be $$41$$. Right?

- 4 years, 9 months ago

I am not asking how to solve this problem; you can view the solutions to see how others approached it.

I'm asking for explanations of why the stated solution was wrong, and what misconception / assumption was made. How can we avoid such mistakes in future?

Staff - 4 years, 9 months ago

The last 3 digits of T-S are 221, not 779. 321-100=221

- 4 years, 9 months ago

Can you justify that claim?

What are the last 3 digits of $$4321 - 9100$$? Why is there a sudden change?

Staff - 4 years, 9 months ago

Oh, I was wrong.Since T<S, the last digits of $$T-S$$ will be equal to the last digits of $$-(S-T)$$. So, it will be 779. So, the answer will be 959 indeed. Thanks for making it clear!

- 4 years, 9 months ago

But Since $$T^2-S^2$$ is a negative number, dividing by 1000 will give remainder -959. Isn't it?

- 4 years, 9 months ago

Wait. the answer will be 41 indeed. We don't want negative remainders. Suppose we want to find the remainder when -1959 is divided by 1000. While doing the normal division we do, we multiply 1000 by -2. What remains is $$-1959+2000=41$$. It can also be thought in this way: $$-1959=41-2000$$

$$-1959(mod 1000)=(41)(mod 1000)-(2000)(mod 1000)$$ $$=41$$ So, answer must be 41 for the case at hand too

- 4 years, 9 months ago

Good, I can see that you are beginning to unwind several notions that are involved in this question.

At the end of the day you should be able to explain why one answer is correct, and the reason why you thought the wrong answer was correct.

Staff - 4 years, 9 months ago

you did it correctly then why is it coming different

- 4 years, 9 months ago