Skip to content

ModularBigInteger Usage Overview

Ugljesa Jovanovic edited this page May 11, 2019 · 1 revision

Modular Integers

Modular arithmetic operations are supported only between integers with the same modulo.

Creating Modular Integers

First define the modulo you are going to use by getting an instance of the creator, and than use that creator to create instances of modular integers

val creator = ModularBigInteger.creatorForModulo(100)
val modularBigInteger = creator.fromLong(150)
println("ModularBigInteger: ${modularBigInteger.toStringWithModulo()}")
----- Output -----
ModularBigInteger: 50 mod 100

Otherwise behavior is similar to normal integers