Skip to main content

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.

Metadata

Release files for prime-bits 1.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for prime-bits 1.0.6
File Size Uploaded Provenance Actions
prime_bits-1.0.6.tar.gz 4.5 kB Without provenance Details for prime_bits-1.0.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for prime-bits 1.0.6
File Interpreter ABI Platform Actions
prime_bits-1.0.6-py3-none-any.whl Python 3 none any Details for prime_bits-1.0.6-py3-none-any.whl

Total release size: 9.8 kB

Release files / prime_bits-1.0.6.tar.gz

Download URL prime_bits-1.0.6.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6832514af5ec5f85b20851a6c63ccc7c54600e52eb66eafba44fff7f4691f3f7
BLAKE2b-256 checksum
How to use checksums
ff81e50433cb8f8305b98f27581b44c228b915f1cbfdaa74dc55d739adfd92ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release files / prime_bits-1.0.6-py3-none-any.whl

Download URL prime_bits-1.0.6-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fa2b9c93b980ee80a5970c71e8f5f00d4fbf0c3e018f97b6c2daa8466effa5bb
BLAKE2b-256 checksum
How to use checksums
d534607969714094b85ac55c351a14d4d9e7a7a0b836f5575e6b06ab13341651
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Security for prime-bits 1.0.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page