codeforces/604D_modular.py
def calculate(self):
        """ Main calcualtion function of the class """

        result = 0
        bp = Binominals(mod=self.p)
        mm = 1
        for m in range(1, self.p):
            mm = bp.mul(mm, self.k)
            if mm == 1:
                break

        bb = Binominals(mod=self.M)
        if self.k == 0:
            result = bb.pow(self.p, self.p-1)
        elif self.k == 1:
            result = bb.pow(self.p, self.p)
        else:
            result = bb.pow(self.p, (self.p-1)//m)

        return str(result)
 Main calcualtion function of the class 
Main calcualtion function of the class
Main calcualtion function of the class
def calculate(self):
        result = 0
        bp = Binominals(mod=self.p)
        mm = 1
        for m in range(1, self.p):
            mm = bp.mul(mm, self.k)
            if mm == 1:
                break
        bb = Binominals(mod=self.M)
        if self.k == 0:
            result = bb.pow(self.p, self.p-1)
        elif self.k == 1:
            result = bb.pow(self.p, self.p)
        else:
            result = bb.pow(self.p, (self.p-1)//m)
        return str(result)
def calculate ( self ) : result = 0 bp = Binominals ( mod = self . p ) mm = 1 for m in range ( 1 , self . p ) : mm = bp . mul ( mm , self . k ) if mm == 1 : break bb = Binominals ( mod = self . M ) if self . k == 0 : result = bb . pow ( self . p , self . p - 1 ) elif self . k == 1 : result = bb . pow ( self . p , self . p ) else : result = bb . pow ( self . p , ( self . p - 1 ) // m ) return str ( result )
Main calcualtion function of the class
Main calcualtion function of the class
""" Main calcualtion function of the class """
self