Class LegendreSymbol

java.lang.Object
de.tilman_neumann.jml.modular.LegendreSymbol

public class LegendreSymbol
extends java.lang.Object
Computation of the Legendre symbol using Eulers formula.
  • Constructor Summary

    Constructors
    Constructor Description
    LegendreSymbol()  
  • Method Summary

    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​(java.math.BigInteger a, int p)
    Computes the Legendre symbol L(a|p) via Eulers formula.
    int EulerFormula​(java.math.BigInteger a, java.math.BigInteger p)
    Computes the Legendre symbol L(a|p) via Eulers formula.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • LegendreSymbol

      public LegendreSymbol()
  • Method Details

    • EulerFormula

      public int EulerFormula​(java.math.BigInteger a, java.math.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​(java.math.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)