A Python library with mathematical utilities: primality testing, prime generation, factorization, and Fibonacci sequence functions.
Project description
HyqerionMath
A Python library providing supplementary mathematical utility functions, focusing on number theory aspects like prime numbers, factorization, and sequences.
Overview
HyqerionMath aims to offer helpful, well-tested math functions that extend Python's built-in math module. It's designed to be simple, efficient, and easy to use.
Features
HyqerionMath includes:
Primality Functions (primality.py)
isprime(number: int) -> bool: Efficiently checks if a given integernumberis a prime number. ReturnsTrueif prime,Falseotherwise. RaisesTypeErrorfor non-integer input.get_nth_prime(n: int) -> int: Finds the n-th prime number (1-based index). e.g.,get_nth_prime(1)is 2,get_nth_prime(5)is 11. RaisesTypeErrorifnis not an integer,ValueErrorifnis not positive.get_primes_in_index_range(start_index: int, end_index: int) -> List[int]: Returns a list containing primes from thestart_index-th prime to theend_index-th prime (inclusive, 1-based). e.g.,get_primes_in_index_range(3, 6)returns[5, 7, 11, 13]. RaisesTypeErrororValueErrorfor invalid indices.find_primes_between(lower_bound: int, upper_bound: int) -> List[int]: Returns a sorted list of all prime numberspsuch thatlower_bound <= p <= upper_bound. e.g.,find_primes_between(10, 30)returns[11, 13, 17, 19, 23, 29]. RaisesTypeErrorfor non-integer bounds. Returns an empty list ifupper_bound < 2orlower_bound > upper_bound.
Factorization Functions (factorization.py)
get_factors(number: int) -> List[int]: Finds all positive integer factors of a givennumber. e.g.,get_factors(12)returns[1, 2, 3, 4, 6, 12]. RaisesTypeErrorfor non-integers,ValueErrorfor non-positive input.get_prime_factorization(number: int) -> List[int]: Returns a sorted list of the prime factors ofnumber(including duplicates). e.g.,get_prime_factorization(20)returns[2, 2, 5]. RaisesTypeErrorfor non-integers,ValueErrorifnumber <= 1.
Sequence Functions (sequences.py)
get_nth_fibonacci(n: int) -> int: Calculates the n-th Fibonacci number using 1-based indexing (F(1)=0, F(2)=1, F(3)=1, F(4)=2...). e.g.,get_nth_fibonacci(5)returns 3. RaisesTypeErrorfor non-integers,ValueErrorfor non-positiven.get_fibonacci_in_index_range(start_index: int, end_index: int) -> List[int]: Returns a list of Fibonacci numbers from thestart_index-th to theend_index-th (inclusive, 1-based). e.g.,get_fibonacci_in_index_range(3, 6)returns[1, 2, 3, 5]. RaisesTypeErrororValueErrorfor invalid indices.
(More features may be added in the future!)
Installation
You can install HyqerionMath directly from PyPI (once published):
pip install hyqerionmath
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
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 hyqerionmath-0.4.0.tar.gz.
File metadata
- Download URL: hyqerionmath-0.4.0.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
604d9d96be976f18ce10cb73dd7e34a7c22ff55d783981b049970160328700e0
|
|
| MD5 |
1c10f362bdf175053ff7ce46f17d7f1d
|
|
| BLAKE2b-256 |
8b1168b4674e4fef6b31cc9e42ecc36838bcc40bc12889dadae96371d979e671
|
File details
Details for the file hyqerionmath-0.4.0-py3-none-any.whl.
File metadata
- Download URL: hyqerionmath-0.4.0-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c94aacbcceacf4ee1299a23b69c98f4b039e0b8715b59dbece99a0fad713ec96
|
|
| MD5 |
c1d1c55bc10d3359a0a06c4886f65b60
|
|
| BLAKE2b-256 |
f9de494b52614f7a76666954f1a0fe42d74c37f733b74bcf558543c35693a94c
|