arithmoi-0.9.0.0: Efficient basic number-theoretic functions.

Copyright(c) 2011 Daniel Fischer 2017-2018 Andrew Lelechenko
LicenseMIT
MaintainerAndrew Lelechenko <andrew.lelechenko@gmail.com>
Safe HaskellNone
LanguageHaskell2010

Math.NumberTheory.Moduli.Jacobi

Description

Jacobi symbol is a generalization of the Legendre symbol, useful for primality testing and integer factorization.

Synopsis

Documentation

jacobi :: (Integral a, Bits a) => a -> a -> JacobiSymbol Source #

Jacobi symbol of two arguments. The lower argument ("denominator") must be odd and positive, this condition is checked.

If arguments have a common factor, the result is Zero, otherwise it is MinusOne or One.

>>> jacobi 1001 9911
Zero -- arguments have a common factor 11
>>> jacobi 1001 9907
MinusOne