A package to get prime numbers from bits.
Project description
Prime Bits
Prime Bits is a project focused on exploring and working with prime numbers in the context of computer science and programming.
Features
- Efficient algorithms for prime number generation.
- Utilities for prime number validation.
- Tools for analyzing prime-related patterns.
How to install
python3 -m pip install prime-bits
How to use
from prime_bits import get_prime
get_prime(1024) # 1024 -> number of bits in the number.
Functions
get_prime- You can see what that function does above. 👆
In the version v1.0.4 I have added 2 additional functions.
get_safe_prime- This function returns a safe prime number. (This uses multi-processing)is_prime- This function checks if the number given is a prime. (This uses the Miller-Rabin primality test)
from prime_bits import get_safe_prime, is_prime
get_safe_prime(1024) # This will act the exact same way as the `get_prime` function. But it will ensure that the prime number given is a safe prime.
is_prime(some_prime_number) # This will checks using the Miller-Rabin primality test, is this number a prime. If so it will return True, False otherwise.
General Utils
gdc(a, b)- Calculate the Greatest Common Divisor (GCD) of two integers using the Euclidean algorithm.lcm(a, b)- Calculate the Least Common Multiple (LCM) of two integers.euler_totient(n)- Calculate Euler's Totient Function φ(n), which counts the integers from 1 to n that are coprime with n.
License
This project is licensed under the MIT License.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
prime_bits-1.0.6.tar.gz
(4.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file prime_bits-1.0.6.tar.gz.
File metadata
- Download URL: prime_bits-1.0.6.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6832514af5ec5f85b20851a6c63ccc7c54600e52eb66eafba44fff7f4691f3f7
|
|
| MD5 |
6eb52a714e40cd76c9d775fa43b8be5b
|
|
| BLAKE2b-256 |
ff81e50433cb8f8305b98f27581b44c228b915f1cbfdaa74dc55d739adfd92ea
|
File details
Details for the file prime_bits-1.0.6-py3-none-any.whl.
File metadata
- Download URL: prime_bits-1.0.6-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa2b9c93b980ee80a5970c71e8f5f00d4fbf0c3e018f97b6c2daa8466effa5bb
|
|
| MD5 |
13efaabcbe82b615d7275607960aeabb
|
|
| BLAKE2b-256 |
d534607969714094b85ac55c351a14d4d9e7a7a0b836f5575e6b06ab13341651
|