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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!