Liking cljdoc? Tell your friends :D

sicmutils.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.

sicmutils.modint also extends many SICMUtils 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.

[[sicmutils.modint]] also extends many SICMUtils 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 :m of all ModInt instances are relatively prime), and returns a ModInt x such that (:i input) == (mod x (:m input)).

For example:

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

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

For example:

```clojure
(let [a1 (m/make 2 5)
      a2 (m/make 3 13)]
  [(= 42 (chinese-remainder a1 a2))
   (= (:i a1) (mod cr (:m a1)))
   (= (:i a2) (mod cr (:m 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

ModIntclj/s

source

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

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

× close