Module number_theory

Module number_theory 

Source

Structs§

PythagoreanTripletGeneratorDeprecated
Deprecated. Please use PythagoreanTripletGenerator2 instead.
PythagoreanTripletGenerator2
An iterator that generates all primitive Pythagorean triplets which satisfy a given condition.

Functions§

chinese_remainder
Chinese remainder theorem for two moduli.
divisor_sigma
Divisor sigma function, which includes the count and sum of divisors.
factorize
Prime factorization.
is_lucas_probable_prime
Strong Lucas probable prime test.
is_palindrome
Tests if the given number is palindrome in the given base.
is_prime
Baillie-PSW primality test.
is_strong_probable_prime
Strong Fermat probable prime test with base 2 for odd n >= 3.
jacobi_symbol
Jacobi symbol (a/n). The value is one of -1, 0, 1, which is represented as respective Sign.
mod_inv
Modular inverse of a modulo m.
mod_inv_range
An O(poly(log m)) algorithm to find the smallest x that satisfies left <= a*x <= right (mod m).
mod_inv_sieve
Modular inverses of 1..a modulo m.
mul_mod
Modulo multiplication; x*y mod m.
next_prime
Calculates the smallest prime greater than n.
nth_prime
Calculates the nth prime.
pow_mod
Modulo power; n^p mod m.
pythagorean_like_triplesDeprecated
Creates a Pythagorean-like triplet generator with a custom starting triple.
pythagorean_like_triples2
Creates a Pythagorean-like triplet generator with a custom starting triple and a filtering function.
pythagorean_triplesDeprecated
Creates a Pythagorean triplet generator with the starting triple of (3, 4, 5).
pythagorean_triples2
Creates a Pythagorean triplet generator with the starting triple of (3, 4, 5) and a filtering function.