1

How do I do this calculation in python? enter image description here

This is what I tried but I guess it's wrong:

 v=(pow(g,s,p)*pow(modinv(b, p), h, p))%p
lastpeony4
  • 549
  • 1
  • 9
  • 22

1 Answers1

0

Much simpler than that. Try like this:

v = (pow(g,s) * pow(b,-h)) % p
Eduardo Soares
  • 992
  • 4
  • 14
  • 1
    That's an assignment, not an equality. Also, "simpler", but also less efficient. Those additional functions OP is using are for making `pow` much faster for large numbers if you want to take the modulus anyways. – tobias_k Dec 21 '18 at 15:47