arith_lib: A set of functions for miscellaneous arithmetic calculation
List of implemented functions
-
gcd(*arg): Greatest common divisor of a set of integers
-
lcm(*arg): Least common multiple of a set of integers
-
bezout(a, b): Provides a particular solution to diophantine equation a.u+b.v=gcd(a, b)
-
modulo_inv(a, b): Inverse of a modulo b
-
chinese_remainder(r, m): Solves the modular system:
- x = r1 mod m1
- x = r2 mod m2
- ...
- x = r_n mod m_n
-
gene_pseudo_prime(): A generator which provides 2, 3, 5 and then all integers non multiple of 2, 3, 5
-
is_prime(n): Check for n primality. Miller-Rabin primality test is used
-
next_prime(n): Provides the first prime greater or equal to n
-
previous_prime(n) Provides the first prime smaller or equal to n
-
prime_factorization(n, frmt): Prime factorization of n
-
divisors(n): Provides all divisors of n
-
phi(n): Euler totient function
-
moebius(n): Moebius function
-
to_base(n, *kwarg): Conversion from base 10 to base B
-
frobenius(*A, n=None): Solves equation a1.x1 + a2.x2 + .. + ap.xp = n or finds the greatest n for which this equation has no solution. a1, a2, ... are positive integers. x1, x2, ... are the unknowns, positive integers
-
isqrt(n) Provides the integer part of the square root of n where n is an integer of any size
-
is_miller_rabin_witness(a, n) Return True if 'a' is a Miller-Rabin witness for n
-
get_random_prime(nbits, lessthan) Provides a random prime with exactly or at most 'nbits' bits
-
is_strong_pseudoprime(a, n) Return True is n is a strong pseudo prime to base 'a'
Installation
pip install arith_lib
Utilization
from arith_lib import *
>>> gcd(15, 20) 5
Metadata
Release files for arith-lib 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| arith_lib-2.0.0.tar.gz | 14.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| arith_lib-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.0 kB
Release files / arith_lib-2.0.0.tar.gz
| Download URL | arith_lib-2.0.0.tar.gz |
|---|---|
| Size | 14.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
304b05d376b69e86e49f1527f3cdc4674c5d8182cbf86f331586ca71b1d5ea47
|
|
BLAKE2b-256 checksum How to use checksums |
ed65b0db31b1fcfd1e22a93708c52d68144e2b12aaf1713ca2ed5b81c5d73ca3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.3
|
Release files / arith_lib-2.0.0-py3-none-any.whl
| Download URL | arith_lib-2.0.0-py3-none-any.whl |
|---|---|
| Size | 16.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ea6c3f6722ca0bfc163c9df5c65eb7a7a70d0b98ef9fcf413b367e9a38f341a7
|
|
BLAKE2b-256 checksum How to use checksums |
380aa70baa27fac1b428229eca1ecb18e9358e7a9dac65bb24e7a18b109046a4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.3
|