def test_lcm(self):
        x = 0
        y = 0
        z = integer_factors.lcm(x, y)
        print(f'z = {z}')
        self.assertTrue(z == 0)

        x = -1
        y = 0
        z = integer_factors.lcm(x, y)
        print(f'z = {z}')
        self.assertTrue(z == 0)
 def __le__(self, other):
     if isinstance(other, int):
         return self.residue <= other  # ??? is this correct?
     elif isinstance(other, ModuloNumber):
         if other.modulo == self.modulo:  # separate these 2 cases for performance reason.
             return self.residue <= other.residue
         else:
             modulo_lcm = int_factors.lcm(self.modulo, other.modulo)
             x = modulo_lcm / other.modulo
             y = modulo_lcm / self.modulo
             return self.residue * x <= other.residue * y
     else:
         raise ValueError('unknow data type: {}'.format(other))
 def __mul__(self, other):
     if isinstance(other, int):
         return ModuloNumber(self.residue * other, self.modulo)
     elif isinstance(other, ModuloNumber):
         if other.modulo == self.modulo:  # separate these 2 cases for performance reason.
             return ModuloNumber(self.residue * other.residue, self.modulo)
         else:
             modulo_lcm = int_factors.lcm(self.modulo, other.modulo)
             x = modulo_lcm / other.modulo
             y = modulo_lcm / self.modulo
             return ModuloNumber(self.residue * x * other.residue * y,
                                 modulo_lcm)
     else:
         raise ValueError('unknow data type: {}'.format(other))