arithmoi-0.9.0.0: Efficient basic number-theoretic functions.

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

Math.NumberTheory.Moduli.Equations

Description

Polynomial modular equations.

Synopsis

Documentation

solveLinear Source #

Arguments

:: KnownNat m 
=> Mod m

a

-> Mod m

b

-> [Mod m]

list of x

Find all solutions of ax + b ≡ 0 (mod m).

>>> :set -XDataKinds
>>> solveLinear (6 :: Mod 10) 4 -- solving 6x + 4 ≡ 0 (mod 10)
[(1 `modulo` 10),(6 `modulo` 10)]

solveQuadratic Source #

Arguments

:: KnownNat m 
=> Mod m

a

-> Mod m

b

-> Mod m

c

-> [Mod m]

list of x

Find all solutions of ax² + bx + c ≡ 0 (mod m).

>>> :set -XDataKinds
>>> solveQuadratic (1 :: Mod 32) 0 (-17) -- solving x² - 17 ≡ 0 (mod 32)
[(9 `modulo` 32),(25 `modulo` 32),(7 `modulo` 32),(23 `modulo` 32)]