Cody

# Problem 2797. modular arithmetic

Solution 3355053

Submitted on 24 Oct 2020
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Fail
assert(isequal(mod_exp(1000,1000,3),1))

Assertion failed.

2   Fail
assert(isequal(mod_exp(1444,2113,104),40))

Assertion failed.

3   Fail
assert(isequal(mod_exp(1043,313,23),16))

Assertion failed.

4   Fail
assert(isequal(mod_exp(1111,1111,111),1))

Assertion failed.

5   Fail
assert(isequal(mod_exp(1531,9898,123),73))

Assertion failed.

6   Fail
assert(isequal(mod_exp(1323,7878,12),9))

Assertion failed.

7   Fail
assert(isequal(mod_exp(4545,1234,786),429))

Assertion failed.

8   Fail
a = [151:160]; b = [311:320]; c = [41:50]; r = [35 22 38 0 35 16 8 16 40 0]; id = randperm(10); a = a(id); b = b(id); c = c(id); r = r(id); for i = 1:10 assert(isequal(mod_exp(a(i),b(i),c(i)),r(i))) end

Assertion failed.

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!