Skip to main content

A mathy Python package with utilities like LCM, triangle numbers, etc.

Project description


📦 Pythagix

Pythagix is a lightweight and dependency-free Python library designed for number theory operations. It provides a clean, efficient interface to common mathematical utilities such as prime number checks, greatest common divisor computation, triangular numbers, and more.


📥 Installation

Install Pythagix using pip:

pip install pythagix

Features

  • is_prime(number: int) -> bool Determine whether a number is a prime number.

  • filter_primes(numbers: List[int]) -> List[int] Return all prime numbers from a list of integers.

  • nth_prime(position: int) -> int Retrieve the n-th prime number (1-based indexing).

  • gcd(values: List[int]) -> int Compute the greatest common divisor (GCD) of a list of integers.

  • is_perfect_square(number: int) -> bool Check whether a number is a perfect square.

  • count_factors(number: int) -> List[int] Return a sorted list of all positive factors of a number.

  • triangle_number(index: int) -> int Compute the n-th triangular number.


Example Usage

from pythagix import is_prime, nth_prime, gcd, triangle_number

print(is_prime(13))         # Output: True

print(nth_prime(10))        # Output: 29

print(gcd([12, 18, 24]))    # Output: 6

print(triangle_number(7))   # Output: 28

Use Cases

Pythagix is ideal for:

  • Educational platforms and math-related tools

  • Prototyping algorithms and number-theoretic computations

  • Teaching foundational concepts in discrete mathematics and number theory

  • Lightweight CLI utilities and academic scripting


License

Pythagix is released under the MIT License, making it free to use, modify, and distribute.


Contributing

Contributions are welcome! If you'd like to add features, report bugs, or improve documentation, please open an issue or submit a pull request on the GitHub repository.


If you want me to tailor this even more (e.g. add badges, GitHub Actions, versioning, or PyPI metadata snippets), I can assist with that too.

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

pythagix-0.1.7.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

pythagix-0.1.7-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file pythagix-0.1.7.tar.gz.

File metadata

  • Download URL: pythagix-0.1.7.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.4

File hashes

Hashes for pythagix-0.1.7.tar.gz
Algorithm Hash digest
SHA256 8db069324890b7a8291844470185d74c2cdc0e0f8747134bbf76c610b47dd65a
MD5 4c6b5a63bb26e569fed389918aebbe1f
BLAKE2b-256 7af963478fb47faf8063ffcd48cb529490b904ae4557a75e699351161126c557

See more details on using hashes here.

File details

Details for the file pythagix-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: pythagix-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.4

File hashes

Hashes for pythagix-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 839475614fc83af605f27635bdf4f7a5a7d7bc4ab90f783a63bb9d3e54fb007e
MD5 e32b4057029ce37568ceba57a6d8410e
BLAKE2b-256 9a0608a382b61d600ed3dd2930b2d5fea0e68a25b4058d43cbb99aeac6be486d

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