×

# 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
3 years, 8 months ago

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 · 3 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}}$$ ? · 3 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. · 3 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 ? · 3 years, 8 months ago

Work out mod 10, mod 100, mod 1000 respectively. · 3 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. · 3 years, 8 months ago

Modulo Arithmetic · 3 years, 8 months ago