We use cookies to personalise content and advertisements and to analyse access to our website. Furthermore, our partners for online advertising receive pseudonymised information about your use of our website. cookie policy and privacy policy.

What is the remainder when 19^((19^19) - 2) is divided by 10^10? Thanks for help.

 Oct 26, 2019

You are right! This is a very tough problem and no ordinary calculator can handle such big exponents, because (19^19) - 2 =1,978,419,655,660,313,589,123,977 - which is 25-digit Prime Number !!.


However, if your class takes computer coding, it can be handled by writing a short computer code to do the calculation for you. Out of curiosity, I wrote the following code in Python to give you the answer to your question:


# Fast python code that first calls pow()  
# then applies % operator
import math as m
a =19
b =(19 ** 19) - 2 
p =10000000000  
# Using direct fast method to compute  
# (a ^ b) % p. 
d = pow(a, b, p) 
print("The Remainder =", f"{d :,d}")  
The Remainder = 7,185,569,139 - This is the answer to your question.
Wall time: 981 µs

 Oct 26, 2019

Thanks guest,


Was this a coding question - I suspect it was.

If so you should have said so int the question.

 Oct 26, 2019

31 Online Users