Power - Mod Power

Sort by

recency

|

318 Discussions

|

  • + 0 comments

    For Python3

    import math from math import pow

    a=int(input()) b=int(input()) m=int(input()) print(int(pow(a,b))) print(a**b %m)

  • + 0 comments

    For Python3

    I guess this is as simple as it can get. If anyone didn't understand, feel free to comment and I will try to explain

    a = int(input())
    b = int(input())
    m = int(input())
    
    print(pow(a, b))
    print(pow(a, b, m))
    
  • + 0 comments

    a=int(input()) b=int(input()) m=int(input()) print(pow(a,b)) print(pow(a,b,m))

  • + 0 comments

    import math a = int(input()) b= int(input()) m = int(input()) d = math.pow(a,b) print(math.floor(d)) mod = d % m print(math.floor(mod))

  • + 0 comments
    def power(a,b,m):
        x = pow(a,b)
        y = pow(a,b,m)
        return f'{x}\n{y}'
    
    if __name__ == '__main__':
        a = int(input())
        b = int(input())
        m = int(input())
        result = power(a,b,m)
        print(result)