arithmoi-0.11.0.1: Efficient basic number-theoretic functions.

Copyright(c) 2018 Bhavik Mehta
LicenseMIT
MaintainerAndrew Lelechenko <andrew.lelechenko@gmail.com>
Safe HaskellNone
LanguageHaskell2010

Math.NumberTheory.Moduli.DiscreteLogarithm

Description

Deprecated: Use Math.NumberTheory.Moduli.Multiplicative instead

Description: Deprecated

Synopsis

Documentation

discreteLogarithm :: CyclicGroup Integer m -> PrimitiveRoot m -> MultMod m -> Natural Source #

Computes the discrete logarithm. Currently uses a combination of the baby-step giant-step method and Pollard's rho algorithm, with Bach reduction.

>>> :set -XDataKinds
>>> import Data.Maybe
>>> let cg = fromJust cyclicGroup :: CyclicGroup Integer 13
>>> let rt = fromJust (isPrimitiveRoot cg 2)
>>> let x  = fromJust (isMultElement 11)
>>> discreteLogarithm cg rt x
7