Let S be the number obtained by writing all the numbers from 1 to 100 in order, and removing the spaces in between. Let T be the number obtained by writing all the numbers from 1 to 100 in reverse order and removing the spaces in between.
What is the remainder when T 2 − S 2 is divided by 1 0 0 0 ?
Details and assumptions
The number obtained by writing all the numbers from 1 to 10 in reverse order and removing the spaces in between, is 1 0 9 8 7 6 5 4 3 2 1 .
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
Won't Tsquared be smaller than Ssquared? They have the same number of digits, but S starts 123 while T starts 100. Can you have a negative remainder?
Log in to reply
It is intentional that T is less than S , which caused several students a problem.
To answer your question, what is the remainder when − 1 2 3 is divided by 1000?
That is exactly my solution.
We have S = 1 2 3 4 5 6 7 8 9 1 0 . . . 1 0 0 ≡ 1 0 0 m o d 1 0 0 0 ⇒ S 2 ≡ 1 0 0 2 m o d 1 0 0 0 ≡ 0 m o d 1 0 0 0
Also,
T = 1 0 0 9 9 9 8 . . . 3 2 1 ≡ 3 2 1 m o d 1 0 0 0 ⇒ T 2 ≡ 3 2 1 2 m o d 1 0 0 0 ≡ 4 1 m o d 1 0 0 0
T 2 − S 2 ≡ 4 1 − 0 m o d 1 0 0 0 ≡ 4 1 m o d 1 0 0 0
∴ R e m a i n d e r = 4 1
Thought of another solution in school today without the use of modular arithmetic :P
S = 1 2 3 4 5 6 7 8 9 . . . 9 9 1 0 0 = 1 2 3 4 5 6 7 8 9 . . . 9 9 0 0 0 + 1 0 0
S 2 = ( 1 2 3 4 5 . . . 9 9 0 0 0 ) 2 + 2 ( 1 2 3 4 5 . . . 9 9 0 0 0 ) ( 1 0 0 ) + 1 0 0 2
Clearly, all the numbers here are divisible by 1000
Similarly,
T 2 = ( 1 0 0 9 9 9 8 . . . 4 0 0 0 + 3 2 1 ) 2
T 2 = 1 0 0 9 9 9 8 . . . 4 0 0 0 2 + 2 ( 1 0 0 9 9 9 8 . . . 4 0 0 0 ) ( 3 2 1 ) + 3 2 1 2
So, evidently, 3 2 1 2 is the only number that will give us a remainder when divided by 1000.
Hence, finding the remainder of T 2 − S 2 when divided by 1000 is equivalent to finding the remainder of 3 2 1 2 when divided by 1000.
Therefore, the remainder is 41.
Log in to reply
Your solutions actually say the same thing, but in a slightly different language. Modular arithmetic is powerful because it allows us to express a complicated idea in a simple form.
Just imagine how hard algebra is, if you were asked to solve
Find a positive number such that what it is squared and added to three, it is equal to 4 times of itself.
We wish to find T 2 − S 2 ( m o d 1 0 0 0 ) . The last three digits of S are 1 0 0 , so
S 2 ≡ 0 ( mod 1 0 0 0 ) ⟹ T 2 − S 2 ≡ T 2 ( mod 1 0 0 0 ) .
The last three digits of T are 3 2 1 , so
3 2 1 2 = 1 0 3 0 4 1 ⟹ T 2 ≡ 4 1 ( mod 1 0 0 0 ) .
The question is asking for T 2 − S 2 ≡ x ( m o d 1 0 0 0 ) , where x is the remainder. Since it's asking for the last 3 digits, we would only care about the last three digits of those huge numbers.
So T = 3 2 1 and S = 1 0 0 .
Calculating T 2 − S 2 ( m o d 1 0 0 0 ) , we get 4 1
Since we are only asked to find the remainder when T 2 − S 2 is divided by 1 0 0 0 , we need only find the last three digits of each of the numbers; then we can find the answer.
First, since S is the first 1 0 0 numbers written in increasing order without spaces, S has last three digits 1 0 0 . Also, we know that T has last three digits 3 2 1 .
Now we calculate the last three digits of S 2 and T 2 . Since the last three digits of S 2 are only dependent on the last three digits of S , the last three digits of S 2 are the last three digits of 1 0 0 2 = 1 0 0 0 0 , which is 0 0 0 . Similarly, the last three digits of T 2 are the last three digits of 3 2 1 2 = 1 0 3 0 4 1 , which are 0 4 1 .
So, our final answer is 4 1 − 0 = 4 1 .
S = 1 2 3 4 5 . . . . . . 9 9 1 0 0
T = 1 0 0 9 9 . . . . . . 5 4 3 2 1
T 2 − S 2 = ( T + S ) ( T − S )
= ( . . . . . 3 2 1 + . . . . . . 1 0 0 ) ( . . . . . 3 2 1 − . . . . . . 1 0 0 )
= ( . . . . . . 4 2 1 ) ( . . . . . . . 2 2 1 )
= . . . . . . . . . 0 4 1
Hence, Remainder = 42
Sorry, the last statement has a mistake, the remainder comes as 41
Log in to reply
I disagree that the last three digits of T − S are 221. What is 4 3 2 1 − 9 1 0 0 ?
This actually gives some insight into the other statements expressing confusion which other students stated.
Log in to reply
this is just an assumption.If we see first 4 to 5 digits of T and S then we will find that T > S .If you solve T − S conventionally by solving on paper you will find last three digits as 221.You will find last three digits as 221 if you solve T − S by considering all the digits of T and S will will be hard to compute.
Log in to reply
@Tilak Patel – Precisely. You have to find the last three digits of a number by considering all of the digits, which you have not done so.
You need to justify that "the last three digits are 221", which I disagree with.
Given that: S = 1 2 3 4 5 . . . 9 9 1 0 0 We have: S ≡ 1 0 0 ( m o d 1 0 0 0 ) S 2 ≡ 1 0 0 2 ≡ 0 ( m o d 1 0 0 0 )
Now, given that: T = 1 0 0 9 9 . . 5 4 3 2 1 We have: T ≡ 3 2 1 ( m o d 1 0 0 0 ) T 2 ≡ 3 2 1 2 ≡ 4 1 ( m o d 1 0 0 0 )
At this point, we have: T 2 − S 2 ≡ 4 1 − 0 ( m o d 1 0 0 0 ) T 2 − S 2 ≡ 4 1 ( m o d 1 0 0 0 )
Thus, our wanted remainder is 4 1 .
S = 123....................9899100
T = 1009998...................321
T 2 − S 2 = ( T + S ) ( T − S ) =(1009998.......321-123......9899100) (1009998.......321+123.....9899100) =(........221)(......421)=..........93041
the number obtained would be exactly divisible by 1000 if there are three 0s at the end so remainder = 41 as when 41 is subtracted from ........93041 the number becomes exactly divisible by 1000
The last two digits of S is "00" , so the last four digits of S^{2} T can be expressed as T=(1000a + 4321) so T^{2} = a\times 10^{6} + 2a\times 4321\times 1000 + 4321^{2} It is obvious that the last three digits of T^{2} is the last three digits of 4321^{2} = 041 Therefore, the answer is 041 ( which is the last three digits of T^{2} - S^{2})
Actually , the question is indirectly asking the last three digits of T 2 − S 2 . Finding last three digits of S 2 and T 2 , S 2 = … 0 0 0 0 , T 2 = … 0 4 1 . Hence T 2 − S 2 = … 0 4 1 and thus , answer is 4 1
You should be careful with your claim. This question does not ask for the last three digits of T 2 − S 2 .
I disagree with your first line. Think about why it is false.
Log in to reply
i couldn't get why it is false , it seems obvious , please explain ..
Log in to reply
T 2 − S 2 ( m o d 1 0 0 0 ) only equals the last three digits of T 2 − S 2 if it is positive, i.e. T > S .
The rest of the product of two numbers can be of the follo form:
(a * b) % x = ( (a % x) * (b % x) ) % x
and the difference too:
(a - b) % x = ( (a % x) - (b % x) ) % x
where m % x represent the rest of divide the number m between the number x
Since T = ...54321 and S = ...9899100 Then fwe have that T % 1000 = 321 and S % 1000 = 100
then
(T² - S²) % 100 = ((T² % 1000) - (S² % 1000)) % 1000 = (((T % 1000) * (T % 1000)) % 1000 - ((S % 1000) * (S % 1000)) %1000) % 1000 = ((321 * 321) % 1000 - (100 * 100) % 1000) % 1000 = (103041 % 1000 - 10000 % 1000) % 1000 = 41
Last 3 digits of S are 100 so S^2 is divisible by 1000 Last 3 digits of T are 321 . So last 4 digits of T^2 are 3041 . when divided by 1000 remainder is 41
Note that any number is congruent to its last three digits modulo 1 0 0 0 , hence $$S \equiv 100 \pmod{1000}$$ $$T \equiv 321 \pmod{1000}$$ so $$T^2 - S^2 \equiv 321^2 - 100^2 \equiv 221 \cdot 421 \equiv \boxed{41} \pmod{1000}$$
Since we need only T 2 − S 2 mod 1000 we can just look at T and S each mod 1000.
The last three digits of T are 3 2 1 , so T 2 = 0 4 1 mod 1000. Similarly, S 2 = 0 0 0 mod 1000, so the desired answer is 0 4 1 − 0 0 0 = 0 4 1 .
First of all, let us notice that S = 1 2 3 4 … 9 8 9 9 1 0 0 and T = 1 0 0 9 9 9 8 … 4 3 2 1 . Now, in order for a number to be divisible by 1 0 0 0 we know that the last 3 digits of the number need to be zeros, which we will use later on. Also, since T and S are very big integers, we will only use the last couple of digits in them to solve the problem, since the rest are not needed at all.
Therefore
S 2 = a b c d … 3 6 1 0 0 0 0
T 2 = m f g n … 9 9 7 1 0 4 1
On the other hand, T 2 − S 2 = p q r s … 6 3 6 1 0 4 1 .
According to the Remainder Theorem, x = y q + r ⇒ x − r = y q , where r is the remainder. This means that if a number divided by another one has a remainder, then that number minus the remainder is divisible by the original divisor. If we apply the theorem to our problem, we'd get
p q r s … 6 3 6 1 0 4 1 − r = 1 0 0 0 q
Since T 2 − S 2 − r needs to be divisible by 1 0 0 0 , we apply the divisibility rule mentioned above. Consequently, the only way to get the last 3 digits of T 2 − S 2 to be zeros is to have the remainder be 4 1 (since p q r s … 6 3 6 1 0 4 1 − 4 1 = p q r s … 6 3 6 1 0 0 0 ), meaning that finally r = 4 1 .
last 3 digits of S^2 are 0000 and last 4 digit of T^2 are 1041 so when you subtract S^2 from T^2 , the last 3 digits will be 041..
Yes, but did anyone notice that the result of the subtraction is negative and therefore, result should be -41 or 1000-41, or am I wrong?
Log in to reply
T = 1 2 3 … and S = 1 0 0 … , and T and S both have the same amount of digits, so it follows that T 2 > S 2 . Also, the question asks for T 2 − S 2 , not S 2 − T 2 . Also, if the last thee digits of S 2 had been greater than T 2 , then the answer would have been 1 0 0 0 − 0 4 1 = 9 5 9 , not 0 0 0 − 0 4 1 = − 4 1 .
Log in to reply
Well that is what I am talking about, but you have made a mistake, T is not greater than S. Here: "Let T be the number obtained by writing all the numbers from 1 to 100 in reverse order and removing the spaces in between. " This means T=10099989796... which is less than S=12345... (S is more than 20% greater), so T^2 - S^2 is definitely negative
Log in to reply
@Alija Bevrnja – This is exactly the confusion that I wanted to create from this problem, by making T 2 − S 2 < 0 . Consider the following question:
If N is a negative integer such that N ≡ 0 4 1 ( m o d 1 0 0 0 ) , what is the remainder when N is divided by 1000?
This helps to test your familiarity with the concept of modular arithmetic.
Log in to reply
@Calvin Lin – Well, using plain division, remainder would be -959, since N = a * 1000 + (-959), where N, a < 0. But here, we have the case that remainder is -41; so I am a bit confused, why is the answer: 41.
Log in to reply
@Alija Bevrnja – An integer n , when divided by q leaves a remainder of r which satisfies 0 ≤ r < q .
− 9 5 9 is not between 0 and 1000.
Log in to reply
@Calvin Lin – Ok. I confused myself with speedy calculations and conclusions. Thank you for this.
Problem Loading...
Note Loading...
Set Loading...
We know that T = 3 2 1 ( m o d 1 0 0 0 ) and S = 1 0 0 ( m o d 1 0 0 0 ) . Thus we see that T 2 − S 2 = 3 2 1 2 − 1 0 0 2 = 1 0 3 0 4 1 − 0 = 4 1 ( m o d 1 0 0 0 )