|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ModularArith
Modular Arithmetic This program calculates the GCD, Extended GCD and Inverse Modulus (a^(-1) mod b) for long integers.
Classes used: Tools, LabMenu
Method Summary | |
static long |
extGCD(long[] aux,
long a,
long b)
Calculates the extended GCD. |
static long |
GCD(long a,
long b)
Calculates the GCD of two integers. |
static long |
inverseMod(long[] aux,
long a,
long b)
Calculates the inverse modulus: a^(-1) mod b |
static void |
main(java.lang.String[] args)
Driver |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static void main(java.lang.String[] args)
public static long GCD(long a, long b)
a
- the first integerb
- the second integerpublic static long extGCD(long[] aux, long a, long b)
aux
- the helper arraya
- the first integerb
- the second integerpublic static long inverseMod(long[] aux, long a, long b)
aux
- the helper arraya
- the baseb
- the the modulus
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |