static public long invModN(long a, long b) { bezout c = idBezout(a, b); if (c.mcd != 1) { throw new ArithmeticException("No existe módulo para " + a + " mod " + b); } if (c.alfa < 0) { return(c.alfa + b); } return(c.alfa); }
static public string toStringBezout(long a, long b) { bezout c = idBezout(a, b); return(c.mcd + "=" + a + "*(" + c.alfa + ")+" + b + "*(" + c.beta + ")"); }