×

Finding the last 1/2/3 digits of a number

Can anyone help me or actually tell me the steps to finding the last 1/2/3 digits of a big number like this $$5^{287^{543}}$$

Note by Nishant Sharma
4 years, 8 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:

5^(287^543) mod 1000

Note that the last 3 digits of 5^3, 5^4, 5^5, 5^6 are 125, 625, 125, 625

This suggests that 5^(odd number>1) mod 1000 = 125, and 5^(even number>2) mod 1000 = 625

You can prove the above by induction.

Since 287^543 is a multiplication of odd numbers, then it must be an odd number as well.

Thus 5^(287^543) mod 1000 = 5^(odd number>1) mod 1000 = 125

- 4 years, 8 months ago

Thanks for the simple sol. But what I want to know is that is there any way out other than using modulo arithmetic and for a general case? Like $$\6^{336^{775}}$$ ?

- 4 years, 8 months ago

There's no escaping modulo arithmetic :)

It is obvious that 6^(336^775) is a multiple of 8, to find the last three digits, it suffices to find what it is congruent to modulo 125

By binomial theorem,

(5+1)^M is congruent to 1 + 5M + 25 MC2 modulo 125

It suffices to find the congruence of M modulo 25 and MC2 modulo 5

For your example: M = 336^775

MC2 = (M)(M-1)/2

and (M -1) is obviously a multiple of 5, thus MC2 is a multiple of 5

M is congruent to 11^775 modulo 25

11^5 is congruent to 1 modulo 25.

M is congruent to 1 modulo 25.

(5+1)^M is congruent to 1 + 5M + 25 MC2 modulo 125

which is congruent to 6 modulo 125

and is thus congruent to 256 modulo 1000

Also, the original question - to find 5^(287^543) modulo 1000 is even simpler. As this number is obviously a multiple of 125, it suffices to find what it is congruent to modulo 8

5^2 = 25 congruent to 1 mod 8, thus 5^(287^543) is congruent to 5 mod 8

the only multiple of 125 less than 1000 congruent to 5 mod 8 is 125, so we are done

You can solve in general by solving for the congruence mod 125 and mod 8. 5 and 6 are easier since they give a lot of free information, but this approach can be generalized reasonably easily.

- 4 years, 8 months ago

Your solution was a bit twisty for me(since i am not comfortable with modulo arithmetic) but i would like to ask u that should we check for the congruence mod 125 for any base ?

- 4 years, 8 months ago

Work out mod 10, mod 100, mod 1000 respectively.

- 4 years, 8 months ago

Actually i don't know how to do that. I'd be grateful 2 u if u could explain a bit further.

- 4 years, 8 months ago

- 4 years, 8 months ago

Easy way to do it? Keep multiplying until you find a pattern.

- 4 years, 8 months ago