Package de.tilman_neumann.jml.modular
Class LegendreSymbol
- java.lang.Object
-
- de.tilman_neumann.jml.modular.LegendreSymbol
-
public class LegendreSymbol extends Object
Computation of the Legendre symbol using Eulers formula.- Author:
- Tilman Neumann
-
-
Constructor Summary
Constructors Constructor Description LegendreSymbol()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
EulerFormula(int a, int p)
Computes the Legendre symbol L(a|p) via Eulers formula for a, p int.int
EulerFormula(BigInteger a, int p)
Computes the Legendre symbol L(a|p) via Eulers formula.int
EulerFormula(BigInteger a, BigInteger p)
Computes the Legendre symbol L(a|p) via Eulers formula.
-
-
-
Method Detail
-
EulerFormula
public int EulerFormula(BigInteger a, BigInteger p)
Computes the Legendre symbol L(a|p) via Eulers formula. p is BigInteger and must be an odd prime. Very slow; if possible use the Jacobi symbol.- Parameters:
a
-p
-- Returns:
- Legendre symbol L(a|p)
-
EulerFormula
public int EulerFormula(BigInteger a, int p)
Computes the Legendre symbol L(a|p) via Eulers formula. p is int and must be an odd prime. Eulers formula with int p is quite fast, but the Jacobi symbol may be faster.- Parameters:
a
-p
-- Returns:
- Legendre symbol L(a|p)
-
EulerFormula
public int EulerFormula(int a, int p)
Computes the Legendre symbol L(a|p) via Eulers formula for a, p int. p must be an odd prime. Eulers formula with int p is quite fast, but the Jacobi symbol may be faster.- Parameters:
a
-p
-- Returns:
- Legendre symbol L(a|p)
-
-