Please subscribe to the official Codeforces channel in Telegram via the link https://t.me/codeforces_official. ×

Help with modulo function needed .

Revision en1, by LovesProgramming, 2019-02-09 06:29:55

I want to calculate ((a/b)^n)%e.

I know, how to calculate (a/b)%e; the formula is: (a%e * (b^-1%e))%e.

So, the answer to the above question should be,

(a^n%e * ((b^n)^-1)%e)%e

Am I right ?

Plus, I know how to calculate b^-1 , but I want to know, how to calculate (b^n)^-1

Thanks .

Tags modulo

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English LovesProgramming 2019-02-09 06:29:55 335 Initial revision (published)