JOIN
 Select a Forum     Round Tables New Member Discussions News Discussions Algorithm Matches Marathon Matches NASA Tournament Lab TopCoder Cookbook High School Matches Sponsor Discussions Development Forums Design Forums Search | Watch Thread  |  My Post History  |  My Watches  |  User Settings View: Flat (newest first)  | Threaded  | Tree Previous Thread  |  Next Thread Forums Algorithm Matches SRM 498 Modular Inverse
 Modular Inverse | Reply I noticed Petr uses modular inverse a lot when doing problems that have solutions mod some prime. I was wondering what he uses them for and why they are useful. Most of the time I read his code and follow it up until he starts using mod Inv and then I'm lost. Anyone care to explain?
 Re: Modular Inverse (response to post by tehqin) | Reply Inverses are useful for dividing...Why the minuses? You people always minus me!
 Re: Modular Inverse (response to post by tehqin) | Reply Imagine you want to calculate a/b mod p,where a divides b, and b is prime to p, i.e gcd(b,p)=1,then:(a/b)mod p=a*inv(b,p) mod p.So you get ride of dividing! this is most useful when a and b are really big numbers.for example when you want to find n!/k! mod a prime number p,when k