Modular multiplicative inverse | A naive method to find modulor multiplicative inverse of ' a ' under modulo ' m ' ; Driver Code ; Function call
< ? php function modInverse ( $ a , $ m ) { for ( $ x = 1 ; $ x < $ m ; $ x ++ ) if ( ( ( $ a % $ m ) * ( $ x % $ m ) ) % $ m == 1 ) return $ x ; } $ a = 3 ; $ m = 11 ; echo modInverse ( $ a , $ m ) ; a . . . >