pythagix 0.1.4__tar.gz → 0.1.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pythagix-0.1.6/PKG-INFO +56 -0
- pythagix-0.1.6/README.md +41 -0
- {pythagix-0.1.4 → pythagix-0.1.6}/pyproject.toml +2 -5
- {pythagix-0.1.4 → pythagix-0.1.6}/pythagix/__init__.py +1 -1
- pythagix-0.1.6/pythagix/core.py +98 -0
- pythagix-0.1.6/pythagix.egg-info/PKG-INFO +56 -0
- {pythagix-0.1.4 → pythagix-0.1.6}/setup.py +1 -1
- pythagix-0.1.4/PKG-INFO +0 -56
- pythagix-0.1.4/README.md +0 -42
- pythagix-0.1.4/pythagix/core.py +0 -144
- pythagix-0.1.4/pythagix.egg-info/PKG-INFO +0 -56
- {pythagix-0.1.4 → pythagix-0.1.6}/LICENSE +0 -0
- {pythagix-0.1.4 → pythagix-0.1.6}/MANIFEST.in +0 -0
- {pythagix-0.1.4 → pythagix-0.1.6}/pythagix.egg-info/SOURCES.txt +0 -0
- {pythagix-0.1.4 → pythagix-0.1.6}/pythagix.egg-info/dependency_links.txt +0 -0
- {pythagix-0.1.4 → pythagix-0.1.6}/pythagix.egg-info/top_level.txt +0 -0
- {pythagix-0.1.4 → pythagix-0.1.6}/setup.cfg +0 -0
pythagix-0.1.6/PKG-INFO
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: pythagix
|
3
|
+
Version: 0.1.6
|
4
|
+
Summary: A mathy Python package with utilities like LCM, triangle numbers, etc.
|
5
|
+
Author: UltraQuantumScriptor
|
6
|
+
License: MIT
|
7
|
+
Keywords: math,prime,LCM,triangle numbers,gcd,utilities
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
10
|
+
Requires-Python: >=3.6
|
11
|
+
Description-Content-Type: text/markdown
|
12
|
+
License-File: LICENSE
|
13
|
+
Dynamic: license-file
|
14
|
+
Dynamic: requires-python
|
15
|
+
|
16
|
+
Pythagix
|
17
|
+
|
18
|
+
Pythagix is a lightweight Python utility library for working with number theory.
|
19
|
+
It offers essential math functions like checking primes, computing triangle numbers, finding GCDs, and more — all in a fast, dependency-free package.
|
20
|
+
|
21
|
+
Installation
|
22
|
+
|
23
|
+
```bash
|
24
|
+
pip install pythagix
|
25
|
+
```
|
26
|
+
Features
|
27
|
+
|
28
|
+
is_prime(number) — Check if a number is prime
|
29
|
+
|
30
|
+
prime_list(numbers: list) — Return all prime numbers from a list
|
31
|
+
|
32
|
+
nth_prime(n) — Get the n-th prime number
|
33
|
+
|
34
|
+
gcd(numbers: list) — Compute the greatest common divisor of a list
|
35
|
+
|
36
|
+
is_perfect_square(n) — Check if a number is a perfect square
|
37
|
+
|
38
|
+
count_factors(n) — Count the total number of factors of a number
|
39
|
+
|
40
|
+
triangle_number(n) — Compute the n-th triangle number
|
41
|
+
|
42
|
+
Example Usage
|
43
|
+
|
44
|
+
```python
|
45
|
+
from pythagix import is_prime, nth_prime, gcd, triangle_number
|
46
|
+
|
47
|
+
print(is_prime(13)) # True
|
48
|
+
print(nth_prime(10)) # 29
|
49
|
+
print(gcd([12, 18, 24])) # 6
|
50
|
+
print(triangle_number(7)) # 28
|
51
|
+
```
|
52
|
+
|
53
|
+
About
|
54
|
+
|
55
|
+
Pythagix was built to give students, developers, and math enthusiasts a clean and simple way to explore number theory in Python.
|
56
|
+
It is ideal for learning, prototyping, or educational tools.
|
pythagix-0.1.6/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
Pythagix
|
2
|
+
|
3
|
+
Pythagix is a lightweight Python utility library for working with number theory.
|
4
|
+
It offers essential math functions like checking primes, computing triangle numbers, finding GCDs, and more — all in a fast, dependency-free package.
|
5
|
+
|
6
|
+
Installation
|
7
|
+
|
8
|
+
```bash
|
9
|
+
pip install pythagix
|
10
|
+
```
|
11
|
+
Features
|
12
|
+
|
13
|
+
is_prime(number) — Check if a number is prime
|
14
|
+
|
15
|
+
prime_list(numbers: list) — Return all prime numbers from a list
|
16
|
+
|
17
|
+
nth_prime(n) — Get the n-th prime number
|
18
|
+
|
19
|
+
gcd(numbers: list) — Compute the greatest common divisor of a list
|
20
|
+
|
21
|
+
is_perfect_square(n) — Check if a number is a perfect square
|
22
|
+
|
23
|
+
count_factors(n) — Count the total number of factors of a number
|
24
|
+
|
25
|
+
triangle_number(n) — Compute the n-th triangle number
|
26
|
+
|
27
|
+
Example Usage
|
28
|
+
|
29
|
+
```python
|
30
|
+
from pythagix import is_prime, nth_prime, gcd, triangle_number
|
31
|
+
|
32
|
+
print(is_prime(13)) # True
|
33
|
+
print(nth_prime(10)) # 29
|
34
|
+
print(gcd([12, 18, 24])) # 6
|
35
|
+
print(triangle_number(7)) # 28
|
36
|
+
```
|
37
|
+
|
38
|
+
About
|
39
|
+
|
40
|
+
Pythagix was built to give students, developers, and math enthusiasts a clean and simple way to explore number theory in Python.
|
41
|
+
It is ideal for learning, prototyping, or educational tools.
|
@@ -1,10 +1,6 @@
|
|
1
|
-
[build-system]
|
2
|
-
requires = ["setuptools>=61.0", "wheel"]
|
3
|
-
build-backend = "setuptools.build_meta"
|
4
|
-
|
5
1
|
[project]
|
6
2
|
name = "pythagix"
|
7
|
-
version = "0.1.
|
3
|
+
version = "0.1.6"
|
8
4
|
description = "A mathy Python package with utilities like LCM, triangle numbers, etc."
|
9
5
|
readme = "README.md"
|
10
6
|
requires-python = ">=3.6"
|
@@ -17,3 +13,4 @@ classifiers = [
|
|
17
13
|
"License :: OSI Approved :: MIT License"
|
18
14
|
]
|
19
15
|
dependencies = []
|
16
|
+
keywords = ["math", "prime", "LCM", "triangle numbers", "gcd", "utilities"]
|
@@ -0,0 +1,98 @@
|
|
1
|
+
from math import isqrt
|
2
|
+
from functools import reduce
|
3
|
+
from typing import List
|
4
|
+
import math
|
5
|
+
|
6
|
+
__all__ = [
|
7
|
+
"is_prime",
|
8
|
+
"filter_primes",
|
9
|
+
"nth_prime",
|
10
|
+
"gcd",
|
11
|
+
"is_perfect_square",
|
12
|
+
"count_factors",
|
13
|
+
"triangle_number",
|
14
|
+
]
|
15
|
+
|
16
|
+
|
17
|
+
def is_prime(n: int) -> bool:
|
18
|
+
"""Check if a number is prime."""
|
19
|
+
if n <= 1:
|
20
|
+
return False
|
21
|
+
if n == 2:
|
22
|
+
return True
|
23
|
+
if n % 2 == 0:
|
24
|
+
return False
|
25
|
+
for i in range(3, isqrt(n) + 1, 2):
|
26
|
+
if n % i == 0:
|
27
|
+
return False
|
28
|
+
return True
|
29
|
+
|
30
|
+
|
31
|
+
def filter_primes(numbers: List[int]) -> List[int]:
|
32
|
+
"""Return only the prime numbers from the list."""
|
33
|
+
return [n for n in numbers if is_prime(n)]
|
34
|
+
|
35
|
+
|
36
|
+
def nth_prime(n: int) -> int:
|
37
|
+
"""Return the n-th prime number (1-indexed)."""
|
38
|
+
if n < 1:
|
39
|
+
raise ValueError("Index must be >= 1")
|
40
|
+
|
41
|
+
count = 0
|
42
|
+
candidate = 2
|
43
|
+
while True:
|
44
|
+
if is_prime(candidate):
|
45
|
+
count += 1
|
46
|
+
if count == n:
|
47
|
+
return candidate
|
48
|
+
candidate += 1
|
49
|
+
|
50
|
+
|
51
|
+
def gcd(numbers: List[int]) -> int:
|
52
|
+
"""Return the GCD of a list of numbers."""
|
53
|
+
if not numbers:
|
54
|
+
raise ValueError("List must not be empty")
|
55
|
+
return reduce(math.gcd, numbers)
|
56
|
+
|
57
|
+
|
58
|
+
def is_perfect_square(n: int) -> bool:
|
59
|
+
"""Check if a number is a perfect square."""
|
60
|
+
if n < 0:
|
61
|
+
return False
|
62
|
+
root = isqrt(n)
|
63
|
+
return root * root == n
|
64
|
+
|
65
|
+
|
66
|
+
def count_factors(n: int) -> List[int]:
|
67
|
+
"""Return all factors of a number."""
|
68
|
+
if n <= 0:
|
69
|
+
raise ValueError("Number must be positive")
|
70
|
+
|
71
|
+
factors = set()
|
72
|
+
for i in range(1, isqrt(n) + 1):
|
73
|
+
if n % i == 0:
|
74
|
+
factors.add(i)
|
75
|
+
factors.add(n // i)
|
76
|
+
return sorted(factors)
|
77
|
+
|
78
|
+
|
79
|
+
def triangle_number(n: int) -> int:
|
80
|
+
"""Return the n-th triangle number."""
|
81
|
+
if n < 0:
|
82
|
+
raise ValueError("n must be >= 0")
|
83
|
+
return n * (n + 1) // 2
|
84
|
+
|
85
|
+
|
86
|
+
# Quick test zone
|
87
|
+
if __name__ == "__main__":
|
88
|
+
|
89
|
+
def main():
|
90
|
+
"""Function for testing other functions."""
|
91
|
+
print("Primes:", filter_primes([1, 2, 3, 4, 5, 16, 17, 19]))
|
92
|
+
print("5th Prime:", nth_prime(5))
|
93
|
+
print("GCD of [12, 18, 24]:", gcd([12, 18, 24]))
|
94
|
+
print("Is 49 perfect square?", is_perfect_square(49))
|
95
|
+
print("Factors of 28:", count_factors(28))
|
96
|
+
print("7th triangle number:", triangle_number(7))
|
97
|
+
|
98
|
+
main()
|
@@ -0,0 +1,56 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: pythagix
|
3
|
+
Version: 0.1.6
|
4
|
+
Summary: A mathy Python package with utilities like LCM, triangle numbers, etc.
|
5
|
+
Author: UltraQuantumScriptor
|
6
|
+
License: MIT
|
7
|
+
Keywords: math,prime,LCM,triangle numbers,gcd,utilities
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
10
|
+
Requires-Python: >=3.6
|
11
|
+
Description-Content-Type: text/markdown
|
12
|
+
License-File: LICENSE
|
13
|
+
Dynamic: license-file
|
14
|
+
Dynamic: requires-python
|
15
|
+
|
16
|
+
Pythagix
|
17
|
+
|
18
|
+
Pythagix is a lightweight Python utility library for working with number theory.
|
19
|
+
It offers essential math functions like checking primes, computing triangle numbers, finding GCDs, and more — all in a fast, dependency-free package.
|
20
|
+
|
21
|
+
Installation
|
22
|
+
|
23
|
+
```bash
|
24
|
+
pip install pythagix
|
25
|
+
```
|
26
|
+
Features
|
27
|
+
|
28
|
+
is_prime(number) — Check if a number is prime
|
29
|
+
|
30
|
+
prime_list(numbers: list) — Return all prime numbers from a list
|
31
|
+
|
32
|
+
nth_prime(n) — Get the n-th prime number
|
33
|
+
|
34
|
+
gcd(numbers: list) — Compute the greatest common divisor of a list
|
35
|
+
|
36
|
+
is_perfect_square(n) — Check if a number is a perfect square
|
37
|
+
|
38
|
+
count_factors(n) — Count the total number of factors of a number
|
39
|
+
|
40
|
+
triangle_number(n) — Compute the n-th triangle number
|
41
|
+
|
42
|
+
Example Usage
|
43
|
+
|
44
|
+
```python
|
45
|
+
from pythagix import is_prime, nth_prime, gcd, triangle_number
|
46
|
+
|
47
|
+
print(is_prime(13)) # True
|
48
|
+
print(nth_prime(10)) # 29
|
49
|
+
print(gcd([12, 18, 24])) # 6
|
50
|
+
print(triangle_number(7)) # 28
|
51
|
+
```
|
52
|
+
|
53
|
+
About
|
54
|
+
|
55
|
+
Pythagix was built to give students, developers, and math enthusiasts a clean and simple way to explore number theory in Python.
|
56
|
+
It is ideal for learning, prototyping, or educational tools.
|
@@ -6,7 +6,7 @@ with open("README.md", encoding="utf-8") as f:
|
|
6
6
|
|
7
7
|
setup(
|
8
8
|
name="pythagix",
|
9
|
-
version="0.1.
|
9
|
+
version="0.1.6",
|
10
10
|
author="UltraQuantumScriptor",
|
11
11
|
description="A mathy Python package with utilities like LCM, triangle numbers, etc.",
|
12
12
|
long_description=long_description,
|
pythagix-0.1.4/PKG-INFO
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.4
|
2
|
-
Name: pythagix
|
3
|
-
Version: 0.1.4
|
4
|
-
Summary: A mathy Python package with utilities like LCM, triangle numbers, etc.
|
5
|
-
Author: UltraQuantumScriptor
|
6
|
-
License: MIT
|
7
|
-
Classifier: Programming Language :: Python :: 3
|
8
|
-
Classifier: License :: OSI Approved :: MIT License
|
9
|
-
Requires-Python: >=3.6
|
10
|
-
Description-Content-Type: text/markdown
|
11
|
-
License-File: LICENSE
|
12
|
-
Dynamic: license-file
|
13
|
-
Dynamic: requires-python
|
14
|
-
|
15
|
-
# 🧠 pythagix
|
16
|
-
|
17
|
-
Math utilities for number nerds.
|
18
|
-
Check primes, compute triangle numbers, find GCDs — all in one lightweight package.
|
19
|
-
Because math shouldn't be a pain 🧮✨
|
20
|
-
|
21
|
-
---
|
22
|
-
|
23
|
-
## 📦 Installation
|
24
|
-
|
25
|
-
```bash
|
26
|
-
pip install pythagix
|
27
|
-
```
|
28
|
-
|
29
|
-
⚙️ Features
|
30
|
-
|
31
|
-
🔢 is_prime(number) — Check if a number is prime
|
32
|
-
|
33
|
-
📜 prime_list([list]) — Return all primes in a list
|
34
|
-
|
35
|
-
🔎 nth_prime(n) — Get the n-th prime number
|
36
|
-
|
37
|
-
🤝 gcd([list]) — Greatest common divisor of a list
|
38
|
-
|
39
|
-
📏 is_perfect_square(n) — Check if n is a perfect square
|
40
|
-
|
41
|
-
🧱 count_factors(n) — Get all factors of a number
|
42
|
-
|
43
|
-
🔺 triangle_number(n) — Get the n-th triangle number
|
44
|
-
|
45
|
-
🧪 Examples
|
46
|
-
```python
|
47
|
-
from pythagix import is_prime, nth_prime, gcd, triangle_number
|
48
|
-
|
49
|
-
print(is_prime(13)) # True
|
50
|
-
print(nth_prime(10)) # 29
|
51
|
-
print(gcd([12, 18, 24])) # 6
|
52
|
-
print(triangle_number(7)) # 28
|
53
|
-
```
|
54
|
-
|
55
|
-
📚 Why?
|
56
|
-
pythagix was built to give math students, coders, and tinkerers a fast and fun way to explore number theory in Python. No heavy dependencies. Just pure mathy goodness.
|
pythagix-0.1.4/README.md
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
# 🧠 pythagix
|
2
|
-
|
3
|
-
Math utilities for number nerds.
|
4
|
-
Check primes, compute triangle numbers, find GCDs — all in one lightweight package.
|
5
|
-
Because math shouldn't be a pain 🧮✨
|
6
|
-
|
7
|
-
---
|
8
|
-
|
9
|
-
## 📦 Installation
|
10
|
-
|
11
|
-
```bash
|
12
|
-
pip install pythagix
|
13
|
-
```
|
14
|
-
|
15
|
-
⚙️ Features
|
16
|
-
|
17
|
-
🔢 is_prime(number) — Check if a number is prime
|
18
|
-
|
19
|
-
📜 prime_list([list]) — Return all primes in a list
|
20
|
-
|
21
|
-
🔎 nth_prime(n) — Get the n-th prime number
|
22
|
-
|
23
|
-
🤝 gcd([list]) — Greatest common divisor of a list
|
24
|
-
|
25
|
-
📏 is_perfect_square(n) — Check if n is a perfect square
|
26
|
-
|
27
|
-
🧱 count_factors(n) — Get all factors of a number
|
28
|
-
|
29
|
-
🔺 triangle_number(n) — Get the n-th triangle number
|
30
|
-
|
31
|
-
🧪 Examples
|
32
|
-
```python
|
33
|
-
from pythagix import is_prime, nth_prime, gcd, triangle_number
|
34
|
-
|
35
|
-
print(is_prime(13)) # True
|
36
|
-
print(nth_prime(10)) # 29
|
37
|
-
print(gcd([12, 18, 24])) # 6
|
38
|
-
print(triangle_number(7)) # 28
|
39
|
-
```
|
40
|
-
|
41
|
-
📚 Why?
|
42
|
-
pythagix was built to give math students, coders, and tinkerers a fast and fun way to explore number theory in Python. No heavy dependencies. Just pure mathy goodness.
|
pythagix-0.1.4/pythagix/core.py
DELETED
@@ -1,144 +0,0 @@
|
|
1
|
-
def filter_prime(number_list: list[int]) -> list[int]:
|
2
|
-
"""
|
3
|
-
Returns a list of all prime numbers from a given list.
|
4
|
-
|
5
|
-
Args:
|
6
|
-
number_list (list[int]): The list of integers to check.
|
7
|
-
|
8
|
-
Returns:
|
9
|
-
list[int]: A list containing only the prime numbers from the input.
|
10
|
-
"""
|
11
|
-
prime_number: list[int] = []
|
12
|
-
for x in number_list:
|
13
|
-
if x == 1:
|
14
|
-
continue
|
15
|
-
for y in range(2, int(x * 1 / 2 + 1)):
|
16
|
-
if x % y == 0:
|
17
|
-
break
|
18
|
-
else:
|
19
|
-
prime_number.append(x)
|
20
|
-
return prime_number
|
21
|
-
|
22
|
-
|
23
|
-
def is_prime(number: int) -> bool:
|
24
|
-
"""
|
25
|
-
Checks whether a number is a prime number.
|
26
|
-
|
27
|
-
Args:
|
28
|
-
number (int): The number to check.
|
29
|
-
|
30
|
-
Returns:
|
31
|
-
bool: True if the number is prime, False otherwise.
|
32
|
-
"""
|
33
|
-
for y in range(2, int(number * 1 / 2)):
|
34
|
-
if number % y == 0:
|
35
|
-
return False
|
36
|
-
else:
|
37
|
-
return True
|
38
|
-
|
39
|
-
|
40
|
-
def nth_prime(index: int) -> int:
|
41
|
-
"""
|
42
|
-
Returns the n-th prime number (1-indexed).
|
43
|
-
|
44
|
-
Args:
|
45
|
-
index (int): The position of the prime to find.
|
46
|
-
|
47
|
-
Returns:
|
48
|
-
int: The n-th prime number.
|
49
|
-
|
50
|
-
Raises:
|
51
|
-
ValueError: If index is less than 1.
|
52
|
-
"""
|
53
|
-
if index < 1:
|
54
|
-
raise ValueError("Index must be >= 1")
|
55
|
-
|
56
|
-
count: int = 0
|
57
|
-
prime_number: int = 2
|
58
|
-
while True:
|
59
|
-
if is_prime(prime_number):
|
60
|
-
count += 1
|
61
|
-
if count == index:
|
62
|
-
return prime_number
|
63
|
-
prime_number += 1
|
64
|
-
|
65
|
-
|
66
|
-
def gcd(number_list: list[int]) -> int:
|
67
|
-
"""
|
68
|
-
Returns the greatest common divisor (GCD) of a list of integers.
|
69
|
-
|
70
|
-
Args:
|
71
|
-
number_list (list[int]): The list of integers.
|
72
|
-
|
73
|
-
Returns:
|
74
|
-
int: The greatest number that divides all elements in the list.
|
75
|
-
"""
|
76
|
-
num: int = 2
|
77
|
-
highest: int = 0
|
78
|
-
while num <= min(number_list):
|
79
|
-
for number in number_list:
|
80
|
-
if number % num != 0:
|
81
|
-
break
|
82
|
-
else:
|
83
|
-
highest = num
|
84
|
-
num += 1
|
85
|
-
return highest
|
86
|
-
|
87
|
-
|
88
|
-
def is_perfect_square(number: int) -> bool:
|
89
|
-
"""
|
90
|
-
Checks whether a number is a perfect square.
|
91
|
-
|
92
|
-
Args:
|
93
|
-
number (int): The number to check.
|
94
|
-
|
95
|
-
Returns:
|
96
|
-
bool: True if the number is a perfect square, False otherwise.
|
97
|
-
"""
|
98
|
-
num: int = 0
|
99
|
-
while num <= number:
|
100
|
-
if num**2 == number:
|
101
|
-
return True
|
102
|
-
num += 1
|
103
|
-
return False
|
104
|
-
|
105
|
-
|
106
|
-
def count_factors(number: int) -> list[int]:
|
107
|
-
"""
|
108
|
-
Returns a list of all factors (divisors) of a number.
|
109
|
-
|
110
|
-
Args:
|
111
|
-
number (int): The number to find factors of.
|
112
|
-
|
113
|
-
Returns:
|
114
|
-
list[int]: A list of all positive integers that divide the number evenly.
|
115
|
-
"""
|
116
|
-
num: int = 1
|
117
|
-
factors: list[int] = []
|
118
|
-
while num <= number:
|
119
|
-
if number % num == 0:
|
120
|
-
factors.append(num)
|
121
|
-
num += 1
|
122
|
-
return factors
|
123
|
-
|
124
|
-
|
125
|
-
def triangle_number(number: int) -> int:
|
126
|
-
"""
|
127
|
-
Returns the n-th triangle number.
|
128
|
-
|
129
|
-
Args:
|
130
|
-
number (int): The term (n) of the triangle number sequence.
|
131
|
-
|
132
|
-
Returns:
|
133
|
-
int: The n-th triangle number, calculated as n(n+1)//2.
|
134
|
-
"""
|
135
|
-
return number * (number + 1) // 2
|
136
|
-
|
137
|
-
|
138
|
-
if __name__ == "__main__":
|
139
|
-
|
140
|
-
def main():
|
141
|
-
"""Runs a quick test of any function."""
|
142
|
-
print(triangle_number(10))
|
143
|
-
|
144
|
-
main()
|
@@ -1,56 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.4
|
2
|
-
Name: pythagix
|
3
|
-
Version: 0.1.4
|
4
|
-
Summary: A mathy Python package with utilities like LCM, triangle numbers, etc.
|
5
|
-
Author: UltraQuantumScriptor
|
6
|
-
License: MIT
|
7
|
-
Classifier: Programming Language :: Python :: 3
|
8
|
-
Classifier: License :: OSI Approved :: MIT License
|
9
|
-
Requires-Python: >=3.6
|
10
|
-
Description-Content-Type: text/markdown
|
11
|
-
License-File: LICENSE
|
12
|
-
Dynamic: license-file
|
13
|
-
Dynamic: requires-python
|
14
|
-
|
15
|
-
# 🧠 pythagix
|
16
|
-
|
17
|
-
Math utilities for number nerds.
|
18
|
-
Check primes, compute triangle numbers, find GCDs — all in one lightweight package.
|
19
|
-
Because math shouldn't be a pain 🧮✨
|
20
|
-
|
21
|
-
---
|
22
|
-
|
23
|
-
## 📦 Installation
|
24
|
-
|
25
|
-
```bash
|
26
|
-
pip install pythagix
|
27
|
-
```
|
28
|
-
|
29
|
-
⚙️ Features
|
30
|
-
|
31
|
-
🔢 is_prime(number) — Check if a number is prime
|
32
|
-
|
33
|
-
📜 prime_list([list]) — Return all primes in a list
|
34
|
-
|
35
|
-
🔎 nth_prime(n) — Get the n-th prime number
|
36
|
-
|
37
|
-
🤝 gcd([list]) — Greatest common divisor of a list
|
38
|
-
|
39
|
-
📏 is_perfect_square(n) — Check if n is a perfect square
|
40
|
-
|
41
|
-
🧱 count_factors(n) — Get all factors of a number
|
42
|
-
|
43
|
-
🔺 triangle_number(n) — Get the n-th triangle number
|
44
|
-
|
45
|
-
🧪 Examples
|
46
|
-
```python
|
47
|
-
from pythagix import is_prime, nth_prime, gcd, triangle_number
|
48
|
-
|
49
|
-
print(is_prime(13)) # True
|
50
|
-
print(nth_prime(10)) # 29
|
51
|
-
print(gcd([12, 18, 24])) # 6
|
52
|
-
print(triangle_number(7)) # 28
|
53
|
-
```
|
54
|
-
|
55
|
-
📚 Why?
|
56
|
-
pythagix was built to give math students, coders, and tinkerers a fast and fun way to explore number theory in Python. No heavy dependencies. Just pure mathy goodness.
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|