This commit is contained in:
Ata Deniz Aydın 2017-05-16 01:38:57 +03:00 committed by GitHub
parent 9f75e71c3e
commit c05cd4986e

View file

@ -11,6 +11,8 @@ class ModP(int):
return "%d %% %d" % (self, self.p)
# arithmetic
def __neg__(self):
return ModP(self.p, self.p - int(self))
def __add__(self, other):
return ModP(self.p, int(self) + int(other))
def __radd__(self, other):