Question: Create a Python module for eea and add the following functions. (a) The EEA function declares two parameters r0 and r1, where r0 > r1

Create a Python module for eea and add the following functions.

(a) The EEA function declares two parameters r0 and r1, where r0 > r1 are positive integers. The function runs the extended Euclidean algorithm and returns a tuple: (gcd(r0, r1), s, t) where gcd(r0, r1) = sr0 + t r1.

(b) The inverse function declares two parameters r0 and r1 and returns r1^1 mod(r0) if exists or None otherwise.

(c) Add the following test function.

def test_inverse():

print(inverse(973, 301))

print(inverse(973, 300))

print(inverse(97333333333333, 300000000))

print(inverse(97333333333333, 5678901234))

The expected output of the program is as follows:

None

853

64888889862222

42314008038032

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!