Liking cljdoc? Tell your friends :D

emmy.modint

This namespace contains an implementation of a [[ModInt]] datatype and various operations for creating and working with [[ModInt]] instances. See "Modular Arithmetic" on Wikipedia for more details about modular arithmetic.

emmy.modint also extends many Emmy generic operations to the [[ModInt]] datatype.

This namespace contains an implementation of a [[ModInt]] datatype and various
operations for creating and working with [[ModInt]] instances. See ["Modular
Arithmetic"](https://en.wikipedia.org/wiki/Modular_arithmetic) on Wikipedia
for more details about modular arithmetic.

[[emmy.modint]] also extends many Emmy generic operations
to the [[ModInt]] datatype.
raw docstring

chinese-remainderclj/s

(chinese-remainder & modints)

Chinese Remainder Algorithm.

Accepts a sequence of [[ModInt]] instances (where the modulus of all [[ModInt]] instances are relatively prime), and returns a [[ModInt]] x such that (residue input) == (mod x (modulus input)).

For example:

(let [a1 (m/make 2 5)
      a2 (m/make 3 13)]
  [(= 42 (chinese-remainder a1 a2))
   (= (residue a1) (mod cr (modulus a1)))
   (= (residue a2) (mod cr (modulus a2)))])
;;=> [true true true]
[Chinese Remainder Algorithm](https://en.wikipedia.org/wiki/Chinese_remainder_theorem).

Accepts a sequence of [[ModInt]] instances (where the `modulus` of
all [[ModInt]] instances are relatively prime), and returns a [[ModInt]] `x`
such that `(residue input) == (mod x (modulus input))`.

For example:

```clojure
(let [a1 (m/make 2 5)
      a2 (m/make 3 13)]
  [(= 42 (chinese-remainder a1 a2))
   (= (residue a1) (mod cr (modulus a1)))
   (= (residue a2) (mod cr (modulus a2)))])
;;=> [true true true]
```
sourceraw docstring

makeclj/s

(make i m)

Returns an instance of [[ModInt]] that represents integer i with integral modulus m.

Returns an instance of [[ModInt]] that represents integer `i` with integral
modulus `m`.
sourceraw docstring

modint?clj/s

(modint? x)

Returns true if x is an instance of [[ModInt]], false otherwise.

Returns true if `x` is an instance of [[ModInt]], false otherwise.
sourceraw docstring

modulusclj/s

(modulus x)
source

residueclj/s

(residue x)
source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close