# Pythagix
Pythagix is a lightweight, dependency-free Python library for number theory operations.
It provides a clean and efficient interface for common mathematical utilities such as prime checking, greatest common divisor, triangular numbers, and more.
Installation
You can install Pythagix using pip:
```bash
pip install pythagix
```
Features
compress_0(values: int | float) -> list[int | float]
Clears consecutive zeros, keeping only one of the zero.
filter_primes(values: list[int]) -> list[int]
Filters and returns prime numbers from a list of integers.
gcd(values: list[int]) -> int
Computes the greatest common divisor (GCD) of a list of integers.
get_factors(number: int) -> List[int]
Return all positive factors of a number.
is_equivalent(ratio1: tuple[int, int], ratio2: tuple[int, int]) -> bool
Check if two ratios are equivalent by simplifying both and comparing.
is_prime(number: int) -> bool
Checks whether a number is prime.
lcm(values: list[int]) -> int
Computes the least common multiple (LCM) of a list of integers.
mean(values: list[int | float]) -> float
Calculates the arithmetic mean (average) of a list of numbers.
median(values: list[int | float]) -> float
Computes the median value of a list.
mode(values: list[int | float]) -> int | float | list[int | float]
Computes the mode(s) of a list. Returns a single value or a list of modes.
nCr(n: int, k: int) -> Union[int, float]
Count all possible k items from n.
nth_prime(position: int) -> int
Retrieves the n-th prime number (1-based index).
prime_factorization(number: int) -> Union[List[int], None]
Find all prime factors of the given number.
prime_factors(number: int) -> list[int]
Get all prime factors of the given number.
product(values: Sequence[int | float]) -> int | float
Multiplies the entire list until one number remains.
pstd_dev(values: Sequence[int | float]) -> float
Determine the standard deviation of the values (population).
pvariance(values: Sequence[int | float]) -> float
Work out the variance of the values (population).
simplify_ratio(ratio: tuple[int, int]) -> tuple[int, int]
Simplify a ratio by dividing both terms by their greatest common divisor (GCD).
std_dev(values: list[int | float]) -> float
Determine the standard deviation of the values (sample).
triangle_number(index: int) -> int
Computes the n-th triangular number.
variance(values: list[int | float]) -> float
Work out the variance of the values (sample).
Use Cases
Pythagix is suitable for:
Educational platforms and math-related applications
Prototyping number-theoretic algorithms
Teaching foundational concepts in discrete mathematics
Lightweight command-line tools and academic scripting
License
This project is licensed under the MIT License.
You are free to use, modify, and distribute the software as permitted under the license terms.
Contributing
Contributions are welcome.
To report bugs, suggest enhancements, or submit code improvements, please open an issue or create a pull request via the GitHub repository.
Raw data
{
"_id": null,
"home_page": null,
"name": "pythagix",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "math, prime, LCM, triangle numbers, gcd, statistics, utilities",
"author": "UltraQuantumScriptor",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/dd/a4/bf7b14e6e092d291d49e5ffe89a5f71970d5f16599778342915139f22767/pythagix-0.2.21.tar.gz",
"platform": null,
"description": "# Pythagix\r\n\r\nPythagix is a lightweight, dependency-free Python library for number theory operations.\r\nIt provides a clean and efficient interface for common mathematical utilities such as prime checking, greatest common divisor, triangular numbers, and more.\r\n\r\nInstallation\r\nYou can install Pythagix using pip:\r\n\r\n```bash\r\npip install pythagix\r\n```\r\n\r\nFeatures\r\n\r\ncompress_0(values: int | float) -> list[int | float]\r\nClears consecutive zeros, keeping only one of the zero.\r\n\r\nfilter_primes(values: list[int]) -> list[int]\r\nFilters and returns prime numbers from a list of integers.\r\n\r\ngcd(values: list[int]) -> int\r\nComputes the greatest common divisor (GCD) of a list of integers.\r\n\r\nget_factors(number: int) -> List[int]\r\nReturn all positive factors of a number.\r\n\r\nis_equivalent(ratio1: tuple[int, int], ratio2: tuple[int, int]) -> bool\r\nCheck if two ratios are equivalent by simplifying both and comparing.\r\n\r\nis_prime(number: int) -> bool\r\nChecks whether a number is prime.\r\n\r\nlcm(values: list[int]) -> int\r\nComputes the least common multiple (LCM) of a list of integers.\r\n\r\nmean(values: list[int | float]) -> float\r\nCalculates the arithmetic mean (average) of a list of numbers.\r\n\r\nmedian(values: list[int | float]) -> float\r\nComputes the median value of a list.\r\n\r\nmode(values: list[int | float]) -> int | float | list[int | float]\r\nComputes the mode(s) of a list. Returns a single value or a list of modes.\r\n\r\nnCr(n: int, k: int) -> Union[int, float]\r\nCount all possible k items from n.\r\n\r\nnth_prime(position: int) -> int\r\nRetrieves the n-th prime number (1-based index).\r\n\r\nprime_factorization(number: int) -> Union[List[int], None]\r\nFind all prime factors of the given number.\r\n\r\nprime_factors(number: int) -> list[int]\r\nGet all prime factors of the given number.\r\n\r\nproduct(values: Sequence[int | float]) -> int | float\r\nMultiplies the entire list until one number remains.\r\n\r\npstd_dev(values: Sequence[int | float]) -> float\r\nDetermine the standard deviation of the values (population).\r\n\r\npvariance(values: Sequence[int | float]) -> float\r\nWork out the variance of the values (population).\r\n\r\nsimplify_ratio(ratio: tuple[int, int]) -> tuple[int, int]\r\nSimplify a ratio by dividing both terms by their greatest common divisor (GCD).\r\n\r\nstd_dev(values: list[int | float]) -> float\r\nDetermine the standard deviation of the values (sample).\r\n\r\ntriangle_number(index: int) -> int\r\nComputes the n-th triangular number.\r\n\r\nvariance(values: list[int | float]) -> float\r\nWork out the variance of the values (sample).\r\n\r\nUse Cases\r\n\r\nPythagix is suitable for:\r\n\r\nEducational platforms and math-related applications\r\n\r\nPrototyping number-theoretic algorithms\r\n\r\nTeaching foundational concepts in discrete mathematics\r\n\r\nLightweight command-line tools and academic scripting\r\n\r\nLicense\r\n\r\nThis project is licensed under the MIT License.\r\nYou are free to use, modify, and distribute the software as permitted under the license terms.\r\n\r\nContributing\r\n\r\nContributions are welcome.\r\n\r\nTo report bugs, suggest enhancements, or submit code improvements, please open an issue or create a pull request via the GitHub repository.\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Pythagix is a lightweight Python library that provides a collection of mathematical utility functions for number theory",
"version": "0.2.21",
"project_urls": {
"Bug Tracker": "https://github.com/UltraQuantumScriptor/pythagix/issues",
"Homepage": "https://github.com/UltraQuantumScriptor/pythagix",
"Source": "https://github.com/UltraQuantumScriptor/pythagix"
},
"split_keywords": [
"math",
" prime",
" lcm",
" triangle numbers",
" gcd",
" statistics",
" utilities"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "aea9b10213f078387fc7f8f0daa5ef20e18b143a22c70a0583a5e2a2d5ba6b2b",
"md5": "a84b022023d8ceac34e0fa2d4115fb0c",
"sha256": "f550622a8c94105f84437a45c36be55268f5645780e6d90a82a181d311d886f4"
},
"downloads": -1,
"filename": "pythagix-0.2.21-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a84b022023d8ceac34e0fa2d4115fb0c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 8109,
"upload_time": "2025-09-08T09:24:33",
"upload_time_iso_8601": "2025-09-08T09:24:33.380667Z",
"url": "https://files.pythonhosted.org/packages/ae/a9/b10213f078387fc7f8f0daa5ef20e18b143a22c70a0583a5e2a2d5ba6b2b/pythagix-0.2.21-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "dda4bf7b14e6e092d291d49e5ffe89a5f71970d5f16599778342915139f22767",
"md5": "ce7e93bae7658db813bd448cd76bed76",
"sha256": "4a8ecb00ff19920dcca5dc4ca4111fe209c0f14bf3df321af998a6183329fad2"
},
"downloads": -1,
"filename": "pythagix-0.2.21.tar.gz",
"has_sig": false,
"md5_digest": "ce7e93bae7658db813bd448cd76bed76",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 7495,
"upload_time": "2025-09-08T09:24:34",
"upload_time_iso_8601": "2025-09-08T09:24:34.704372Z",
"url": "https://files.pythonhosted.org/packages/dd/a4/bf7b14e6e092d291d49e5ffe89a5f71970d5f16599778342915139f22767/pythagix-0.2.21.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-08 09:24:34",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "UltraQuantumScriptor",
"github_project": "pythagix",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pythagix"
}