Skip to main content

Crate primefactor

Crate primefactor 

Source
Expand description

Module for factorizing integers

Modules§

candidates
There are many functions that can produce prime number candidates, but only a few that are guaranteed to produce all primes.

Structs§

IntFactor
A prime factor with its exponent (e.g., 2^3 means integer=2, exponent=3).
PrimeFactors
The prime factorization of an integer, represented as a list of prime factors with their exponents.
PrimeNumbers
An iterator that yields prime numbers in ascending order. Uses wheel factorization to generate candidates, filtering with Miller-Rabin (when available) for fast primality testing.

Functions§

checked_u128_lcm
next_prime
Return the smallest prime >= n.
primefactor_gcd
Calculate the Greatest common divisor (GCD) between 2 unsigned integers, returned as a prime factorization.
u128_gcd
Calculate the Greatest common divisor (GCD) between 2 unsigned integers. Based on Euclid’s algorithm pseudo code at: https://en.wikipedia.org/wiki/Euclidean_algorithm
u128_is_prime
Test if the value is a prime number.
u128_lcm
Calculate the Least common multiple (LCM) for 2 integers.