# 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
count_factors(number: int) -> list[int]
Returns a sorted list of all positive factors of the given number.
digit_sum(number: int) -> int
Returns the sum of all digits in the given number.
filter_primes(values: list[int]) -> list[int]
Filters and returns prime numbers from a list of integers.
from_percentage(number: int | float) -> float
Convert a percentage to a decimal.
gcd(values: list[int]) -> int
Computes the greatest common divisor (GCD) of a list of integers.
is_equivalent(ratio1: tuple[int, int], ratio2: tuple[int, int]) -> bool
Check if two ratios are equivalent by simplifying both and comparing.
is_perfect_square(number: int) -> bool
Determines whether a number is a perfect square.
is_prime(number: int) -> bool
Checks whether a number is prime.
is_multiple(number: int, base: int) -> bool
Checks if one number is a multiple of another.
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.
middle(a: int | float, b: int | float) -> float
Returns the midpoint of two numeric values.
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.
nth_prime(position: int) -> int
Retrieves the n-th prime number (1-based index).
prime_factors(number: int) -> list[int]
Get all prime factors of the given number.
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[float]) -> float
Determine the standard deviation of the values
to_percentage(number: int | float) -> int | float
Convert a decimal to a percentage.
triangle_number(index: int) -> int
Computes the n-th triangular number.
variance(values: list[float]) -> float
Work out the variance of the values.
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/bf/69/2cc552987fca944ec77d50c62a8a669c35ac3f04ea91df4cd29ccc429774/pythagix-0.2.14.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\n---\r\n\r\n\r\nInstallation\r\n\r\nYou can install Pythagix using pip:\r\n\r\n```bash\r\npip install pythagix\r\n```\r\n\r\n\r\nFeatures\r\n\r\ncount_factors(number: int) -> list[int]\r\nReturns a sorted list of all positive factors of the given number.\r\n\r\ndigit_sum(number: int) -> int\r\nReturns the sum of all digits in the given number.\r\n\r\nfilter_primes(values: list[int]) -> list[int]\r\nFilters and returns prime numbers from a list of integers.\r\n\r\nfrom_percentage(number: int | float) -> float\r\nConvert a percentage to a decimal.\r\n\r\ngcd(values: list[int]) -> int\r\nComputes the greatest common divisor (GCD) of a list of integers.\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_perfect_square(number: int) -> bool\r\nDetermines whether a number is a perfect square.\r\n\r\nis_prime(number: int) -> bool\r\nChecks whether a number is prime.\r\n\r\nis_multiple(number: int, base: int) -> bool\r\nChecks if one number is a multiple of another.\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\nmiddle(a: int | float, b: int | float) -> float\r\nReturns the midpoint of two numeric values.\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\nnth_prime(position: int) -> int\r\nRetrieves the n-th prime number (1-based index).\r\n\r\nprime_factors(number: int) -> list[int]\r\nGet all prime factors of the given number.\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[float]) -> float\r\nDetermine the standard deviation of the values\r\n\r\nto_percentage(number: int | float) -> int | float\r\nConvert a decimal to a percentage.\r\n\r\ntriangle_number(index: int) -> int\r\nComputes the n-th triangular number.\r\n\r\nvariance(values: list[float]) -> float\r\nWork out the variance of the values.\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\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": "A mathy Python package with utilities like LCM, triangle numbers, etc.",
"version": "0.2.14",
"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": "0821d5715ea4601e03542baccc1e878e274d445dcec1658210a53b38ea1b6052",
"md5": "41bf2639e0876e491c1234ba28df6d98",
"sha256": "e71299bb4e7e8cb25023142900412f53726bc13b27b711c60fd89ff5b5b9de37"
},
"downloads": -1,
"filename": "pythagix-0.2.14-py3-none-any.whl",
"has_sig": false,
"md5_digest": "41bf2639e0876e491c1234ba28df6d98",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 8315,
"upload_time": "2025-07-24T11:44:09",
"upload_time_iso_8601": "2025-07-24T11:44:09.334508Z",
"url": "https://files.pythonhosted.org/packages/08/21/d5715ea4601e03542baccc1e878e274d445dcec1658210a53b38ea1b6052/pythagix-0.2.14-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "bf692cc552987fca944ec77d50c62a8a669c35ac3f04ea91df4cd29ccc429774",
"md5": "177b3a8e724a2ab8beb448ff83eb32a6",
"sha256": "1284c5c2356eaf8fa9d0256ee1909016dd0a4d1fc9599b38ed7fe1afbd33d129"
},
"downloads": -1,
"filename": "pythagix-0.2.14.tar.gz",
"has_sig": false,
"md5_digest": "177b3a8e724a2ab8beb448ff83eb32a6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 7548,
"upload_time": "2025-07-24T11:44:10",
"upload_time_iso_8601": "2025-07-24T11:44:10.518928Z",
"url": "https://files.pythonhosted.org/packages/bf/69/2cc552987fca944ec77d50c62a8a669c35ac3f04ea91df4cd29ccc429774/pythagix-0.2.14.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-24 11:44:10",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "UltraQuantumScriptor",
"github_project": "pythagix",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pythagix"
}