Recall that (" is equivalent to modulo ") if is a multiple of Implement a function that, given three arguments , and , tells us whether .

def is_equivalent(a, b, m):
"""Return a boolean indicating whether the equivalence is satisfied.

Args:
a (int): First number to check the equivalence.
b (int): Second number to check the equivalence.
m (int): Modulus of the equivalence.

Returns:
bool: True if a = b (m), False otherwise.
"""

##################
# YOUR CODE HERE #
##################


print(f"13 = 8 (3) is {is_equivalent(13, 8, 3)}")
print(f"13 = 7 (6) is {is_equivalent(13, 7, 6)}")

or to submit your code

To interact with codercises, please switch to a larger screen size.

Learning Objectives:

  • Explain the purpose of Shor's algorithm.
  • Describe the concept of modular arithmetic.
  • Define its main operations and properties.