1.0.0 • Published 7 months ago

modular-arithmetic.js v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

🧮 modular-arithmetic.js

This is a JavaScript implementation of a couple of modular arithmetic algorithms we learnt in CS70.

Add the package using yarn add modular-arithmetic.js or npm install modular-arithmetic.js. Alternatively, you can also import it directly from Skypack through URL imports:

import { Stack, Collection, Queue } from 'https://cdn.skypack.dev/modular-arithmetic.js';

The package exports the following functions:

mod(n, d): return n in mod(d).

extendedEuclideanAlgorithm(x, y): perform the extended Euclidean algorithm on x and y.

inverseMod(x, y): return the multiplicative inverse of x in mod(y).

gcd(x, y): returns the greatest common divisor of x and y.

1.0.0

7 months ago