quadratic_residues 0.1.4

A library for calculating quadratic residues of integers
Documentation
  • Coverage
  • 75%
    3 out of 4 items documented0 out of 3 items with examples
  • Size
  • Source code size: 4.74 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 162.78 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • gsspdev/quadratic_residues
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • gsspdev

Rust Crate for Calculating Quadratic Residues of an Integer

Description

"In number theory, an integer q is called a quadratic residue modulo n if it is congruent to a perfect square modulo n; i.e., if there exists an integer x such that: $$x^2 \equiv q \pmod{n}$$ Otherwise, q is called a quadratic nonresidue modulo n.

Originally an abstract mathematical concept from the branch of number theory known as modular arithmetic, quadratic residues are now used in applications ranging from acoustical engineering to cryptography and the factoring of large numbers."

Source: https://en.wikipedia.org/wiki/Quadratic_residue

For a quick overview of quadratic residues I recommend this video from Michael Penn.

Usage

Add the Crate to Your Project

Using cargo:

cargo add quadratic_residues

or add it manually to your Cargo.toml file:

[dependencies]
quadratic_residues = "0.1.4"

To use the crate in your project:

use quadratic_residues::{ quadratic_residues, quadratic_non_residues, quadratic_residues_all };

Examples:

quadratic_residues(7) => [1, 2, 4] // returns the quadratic residues of 7
quadratic_non_residues(7) => [3, 5, 6] // returns the quadratic non-residues of 7
quadratic_residues_all(7) => [1, 4, 2, 2, 4, 1] // returns the quadratic residues of 7 including duplicates