Question: ` ` ` In [ ] : def find _ all _ modular _ reciprocals ( n ) : I = [ 1 ] *

```
In []: def find_all_modular_reciprocals(n):
I =[1]*n # initialize an array of size n with all 1s
# your code here
raise NotImplementedError
```
In []: def test_modular_reciprocals(p):
print(f'Testing for n ={p}')
I = find_all_modular_reciprocals(p)
for j in range(1, p):
assert (I[j]* j)%p==1, f'Failed: p ={p}, j ={j}, I[j]={I[j]},(j*I[j])%p ={(j*I[j])%p},
print('\t passed')
test_modular_reciprocals(5)
test_modular_reciprocals(11)
test_modular_reciprocals(19)
test_modular_reciprocals(113)
test_modular_reciprocals(1009)
test_modular_reciprocals(1013)
test_modular_reciprocals(7753)
test_modular_reciprocals(971767)
test_modular_reciprocals(999983)
test_modular_reciprocals(7304107)
test_modular_reciprocals(9999991)
print('Passed: 10 points')|
` ` ` In [ ] : def find _ all _ modular _

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 Programming Questions!