Skip to main content

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 current version v1.0.4 I have added 2 additional functions.

  • get_safe_prime - This function get's 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.5.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

prime_bits-1.0.5-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file prime_bits-1.0.5.tar.gz.

File metadata

  • Download URL: prime_bits-1.0.5.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for prime_bits-1.0.5.tar.gz
Algorithm Hash digest
SHA256 face9b1311cf2fae115636b7899258b28f2d00283076b10295922160cd0b5a55
MD5 91b25040217805f479bb8ef5e9ead281
BLAKE2b-256 4249358da2a1ae16e03463470ddb64e1752a601923eb0da545b50b6779649e6f

See more details on using hashes here.

File details

Details for the file prime_bits-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: prime_bits-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for prime_bits-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ef2a042448d8dace572cf621df5cc9b656c403a1de3c44a86291e6bba88b72da
MD5 48afc61f8987ba7778c56deaf4503291
BLAKE2b-256 da619d92669373bbceb785bb37a9d3871d3a8f5df57ce29a02882972f194385e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page