number-utils
A library to perform various operations on prime numbers.
Installation
pip install number-utils
Usage
>>> import number_utils
>>> dir(number_utils)
['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__',
'__package__', '__path__', '__spec__', 'are_mutually_prime', 'factor_pairs', 'factors',
'highest_power', 'is_prime', 'mutually_prime_factor_pairs', 'number_of_divisors',
'number_of_factor_pairs', 'number_of_mutually_prime_factor_pairs', 'prime_factorise',
'prime_factors', 'prime_over', 'prime_under', 'primes', 'primes_between', 'primes_under',
'sum_of_divisors']
>>>
>>> # Examples
>>> from number_utils import is_prime, are_mutually_prime, prime_factorise
>>> is_prime(101)
True
>>> are_mutually_prime(24, 77)
True
>>> prime_factorise(21600, show=True)
2^5 * 3^3 * 5^2
[(2, 5), (3, 3), (5, 2)]
>>>
>>> help(prime_factorise)
Help on function prime_factorise in module number_utils.primes:
prime_factorise(n, show=False)
Prime factorisation.
If `show` is True, print an expression of the form:
a^p * b^q * c^r
where a, b, c, etc. are prime factors of n and p, q, r, etc. are
their powers.
Return a list of tuples of prime factor and power.
>>>
>>> help(number_utils.highest_power)
Help on function highest_power in module number_utils.primes:
highest_power(m: int, n: int)
Highest power of a prime m in n!
Formula: Sum of greatest integers contained in (n / m^i), where i
is 1, 2, 3, etc.
Metadata
Release files for number-utils 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| number-utils-0.0.2.tar.gz | 3.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| number_utils-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.9 kB
Release files / number-utils-0.0.2.tar.gz
| Download URL | number-utils-0.0.2.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2c9c17f5c97fdb94ff52cd4902fc458810e5ae9d42001a7a80ebabf54d6fafb7
|
|
BLAKE2b-256 checksum How to use checksums |
74e6fd481c2fa4e46f06de5ed84dbaf5d19b6ca6a28073121c270a707303a5f0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10
|
Release files / number_utils-0.0.2-py3-none-any.whl
| Download URL | number_utils-0.0.2-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3b9ea2e6ad0b00fb3adae90c944028dad88967e61a290bb5e8941653493bb288
|
|
BLAKE2b-256 checksum How to use checksums |
db9535aa06cd4728a587af6395bea8756ed956dc74683966d5ba5aea9eeca51a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10
|