Question: # 5. Create a function for modular exponentiation. Your function should compute in a reasonable time for exponents on the order of 10 billion def
# 5. Create a function for modular exponentiation. Your function should compute in a reasonable time for exponents on the order of 10 billion def modExp(n, p, m): # Provide your code here print "3^644 (mod 645):\t\t", modExp(3, 644, 645) # => 36
print "3^9876543210 (mod 2017):\t", modExp(3, 9876543210, 2017) # => 1040
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
