feat: update mod inv
This commit is contained in:
@@ -17,6 +17,7 @@ public class ModularInv {
|
||||
// a^-1 mod p
|
||||
BigInteger x = a.modInverse(p);
|
||||
BigInteger y = modularInv(a, p);
|
||||
// a^(phi(p)-1) mod p
|
||||
BigInteger z = a.modPow(Phi.phi(p).subtract(BigInteger.ONE), p);
|
||||
System.out.println(Arrays.asList(a + "^-1 mod " + p, x, y, z));
|
||||
if (!y.equals(x) || !y.equals(z)) {
|
||||
|
||||
Reference in New Issue
Block a user