Class LegendreSymbol


  • public class LegendreSymbol
    extends Object
    Computation of the Legendre symbol using Eulers formula.
    Author:
    Tilman Neumann
    • Constructor Detail

      • LegendreSymbol

        public LegendreSymbol()
    • 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)