Class JacobiSymbol

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

public class JacobiSymbol
extends java.lang.Object
Jacobi symbol. The basic implementation follows [Crandall, Pomerance 2005: Prime numbers]; then we apply some optimizations.
  • Constructor Summary

    Constructors
    Constructor Description
    JacobiSymbol()  
  • Method Summary

    Modifier and Type Method Description
    int jacobiSymbol​(int a, int m)  
    int jacobiSymbol​(int a, java.math.BigInteger m)  
    int jacobiSymbol​(java.math.BigInteger a, int m)  
    int jacobiSymbol​(java.math.BigInteger a, java.math.BigInteger m)
    Jacobi symbol J(a|m), with m an odd, positive integer.
    int kroneckerSymbol​(java.math.BigInteger a, java.math.BigInteger m)
    The Kronecker symbol K(a|m) generalizes the Jacobi symbol J(a|m) for arbitrary natural numbers m.

    Methods inherited from class java.lang.Object

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

    • JacobiSymbol

      public JacobiSymbol()
  • Method Details

    • jacobiSymbol

      public int jacobiSymbol​(java.math.BigInteger a, java.math.BigInteger m)
      Jacobi symbol J(a|m), with m an odd, positive integer. Highly optimized, using faster quadratic reciprocity.
      Parameters:
      a -
      m - modulus, an odd integer
      Returns:
      J(a|m)
    • jacobiSymbol

      public int jacobiSymbol​(java.math.BigInteger a, int m)
    • jacobiSymbol

      public int jacobiSymbol​(int a, java.math.BigInteger m)
    • jacobiSymbol

      public int jacobiSymbol​(int a, int m)
    • kroneckerSymbol

      public int kroneckerSymbol​(java.math.BigInteger a, java.math.BigInteger m)
      The Kronecker symbol K(a|m) generalizes the Jacobi symbol J(a|m) for arbitrary natural numbers m. Note that the Kronecker symbol does not have the same connection to quadratic residues as the Jacobi symbol. In particular, the Kronecker symbol K(a|m) for even m can take values independently on whether a is a quadratic residue or nonresidue modulo m. See https://en.wikipedia.org/wiki/Kronecker_symbol#Properties
      Parameters:
      a -
      m -
      Returns:
      K(a|m)