Power - Mod Power

Sort by

recency

|

315 Discussions

|

  • + 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)
    
  • [deleted]
    + 0 comments

    For Python3

    I think this is as simple as it gets

    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

    All done in two lines!

    print(pow(int(input()), int(input())))
    print(pow(int(input()),int(input()),int(input())