All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class Supporting.Numerical

java.lang.Object
   |
   +----Supporting.Numerical

public final class Numerical
extends java.lang.Object
Class that contains a selection of numerical routines.


Variable Index

 o TRIALS
The number of witnesses queried in randomized primality test.

Constructor Index

 o Numerical()

Method Index

 o gcd(long, long)
Return the greatest common divisor.
 o inverse(long, long)
Solve ax == 1 (mod n), assuming gcd( a, n ) = 1.
 o isPrime(long)
Randomized primality test.
 o power(long, long, long)
Return x^n (mod p) Assumes x, n >= 0, p > 0, x < p, 0^0 = 1 Overflow may occur if p > 31 bits.

Variables

 o TRIALS
 public static final int TRIALS
The number of witnesses queried in randomized primality test.

Constructors

 o Numerical
 public Numerical()

Methods

 o power
 public static long power(long x,
                          long n,
                          long p)
Return x^n (mod p) Assumes x, n >= 0, p > 0, x < p, 0^0 = 1 Overflow may occur if p > 31 bits.

 o isPrime
 public static boolean isPrime(long n)
Randomized primality test. Adjust TRIALS to increase confidence level.

Parameters:
n - the number to test.
Returns:
if false, n is definitely not prime. If true, n is probably prime.
 o gcd
 public static long gcd(long a,
                        long b)
Return the greatest common divisor.

 o inverse
 public static long inverse(long a,
                            long n)
Solve ax == 1 (mod n), assuming gcd( a, n ) = 1.

Returns:
x.

All Packages  Class Hierarchy  This Package  Previous  Next  Index