pythagix 0.1.4__tar.gz → 0.1.7__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.
@@ -0,0 +1,103 @@
1
+ Metadata-Version: 2.4
2
+ Name: pythagix
3
+ Version: 0.1.7
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
+ ---
17
+
18
+ # 📦 Pythagix
19
+
20
+ **Pythagix** is a lightweight and dependency-free Python library designed for number theory operations.
21
+ It provides a clean, efficient interface to common mathematical utilities such as prime number checks, greatest common divisor computation, triangular numbers, and more.
22
+
23
+ ---
24
+
25
+ ## 📥 Installation
26
+
27
+ Install Pythagix using pip:
28
+
29
+ ```bash
30
+ pip install pythagix
31
+ ```
32
+
33
+ ---
34
+
35
+ ## Features
36
+
37
+ * `is_prime(number: int) -> bool`
38
+ Determine whether a number is a prime number.
39
+
40
+ * `filter_primes(numbers: List[int]) -> List[int]`
41
+ Return all prime numbers from a list of integers.
42
+
43
+ * `nth_prime(position: int) -> int`
44
+ Retrieve the *n*-th prime number (1-based indexing).
45
+
46
+ * `gcd(values: List[int]) -> int`
47
+ Compute the greatest common divisor (GCD) of a list of integers.
48
+
49
+ * `is_perfect_square(number: int) -> bool`
50
+ Check whether a number is a perfect square.
51
+
52
+ * `count_factors(number: int) -> List[int]`
53
+ Return a sorted list of all positive factors of a number.
54
+
55
+ * `triangle_number(index: int) -> int`
56
+ Compute the *n*-th triangular number.
57
+
58
+ ---
59
+
60
+ ## Example Usage
61
+
62
+ ```python
63
+ from pythagix import is_prime, nth_prime, gcd, triangle_number
64
+
65
+ print(is_prime(13)) # Output: True
66
+
67
+ print(nth_prime(10)) # Output: 29
68
+
69
+ print(gcd([12, 18, 24])) # Output: 6
70
+
71
+ print(triangle_number(7)) # Output: 28
72
+ ```
73
+
74
+ ---
75
+
76
+ ## Use Cases
77
+
78
+ Pythagix is ideal for:
79
+
80
+ * Educational platforms and math-related tools
81
+
82
+ * Prototyping algorithms and number-theoretic computations
83
+
84
+ * Teaching foundational concepts in discrete mathematics and number theory
85
+
86
+ * Lightweight CLI utilities and academic scripting
87
+
88
+ ---
89
+
90
+ ## License
91
+
92
+ Pythagix is released under the [MIT License](LICENSE), making it free to use, modify, and distribute.
93
+
94
+ ---
95
+
96
+ ## Contributing
97
+
98
+ Contributions are welcome!
99
+ 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](https://github.com/your-username/pythagix).
100
+
101
+ ---
102
+
103
+ 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.
@@ -0,0 +1,88 @@
1
+ ---
2
+
3
+ # 📦 Pythagix
4
+
5
+ **Pythagix** is a lightweight and dependency-free Python library designed for number theory operations.
6
+ It provides a clean, efficient interface to common mathematical utilities such as prime number checks, greatest common divisor computation, triangular numbers, and more.
7
+
8
+ ---
9
+
10
+ ## 📥 Installation
11
+
12
+ Install Pythagix using pip:
13
+
14
+ ```bash
15
+ pip install pythagix
16
+ ```
17
+
18
+ ---
19
+
20
+ ## Features
21
+
22
+ * `is_prime(number: int) -> bool`
23
+ Determine whether a number is a prime number.
24
+
25
+ * `filter_primes(numbers: List[int]) -> List[int]`
26
+ Return all prime numbers from a list of integers.
27
+
28
+ * `nth_prime(position: int) -> int`
29
+ Retrieve the *n*-th prime number (1-based indexing).
30
+
31
+ * `gcd(values: List[int]) -> int`
32
+ Compute the greatest common divisor (GCD) of a list of integers.
33
+
34
+ * `is_perfect_square(number: int) -> bool`
35
+ Check whether a number is a perfect square.
36
+
37
+ * `count_factors(number: int) -> List[int]`
38
+ Return a sorted list of all positive factors of a number.
39
+
40
+ * `triangle_number(index: int) -> int`
41
+ Compute the *n*-th triangular number.
42
+
43
+ ---
44
+
45
+ ## Example Usage
46
+
47
+ ```python
48
+ from pythagix import is_prime, nth_prime, gcd, triangle_number
49
+
50
+ print(is_prime(13)) # Output: True
51
+
52
+ print(nth_prime(10)) # Output: 29
53
+
54
+ print(gcd([12, 18, 24])) # Output: 6
55
+
56
+ print(triangle_number(7)) # Output: 28
57
+ ```
58
+
59
+ ---
60
+
61
+ ## Use Cases
62
+
63
+ Pythagix is ideal for:
64
+
65
+ * Educational platforms and math-related tools
66
+
67
+ * Prototyping algorithms and number-theoretic computations
68
+
69
+ * Teaching foundational concepts in discrete mathematics and number theory
70
+
71
+ * Lightweight CLI utilities and academic scripting
72
+
73
+ ---
74
+
75
+ ## License
76
+
77
+ Pythagix is released under the [MIT License](LICENSE), making it free to use, modify, and distribute.
78
+
79
+ ---
80
+
81
+ ## Contributing
82
+
83
+ Contributions are welcome!
84
+ 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](https://github.com/your-username/pythagix).
85
+
86
+ ---
87
+
88
+ 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.
@@ -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.4"
3
+ version = "0.1.7"
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"]
@@ -1,6 +1,6 @@
1
1
  # pythagix/__init__.py
2
2
  from .core import (
3
- prime_list,
3
+ filter_primes,
4
4
  is_prime,
5
5
  nth_prime,
6
6
  gcd,
@@ -0,0 +1,160 @@
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(number: int) -> bool:
18
+ """
19
+ Check whether a given integer is a prime number.
20
+
21
+ Args:
22
+ number (int): The number to check.
23
+
24
+ Returns:
25
+ bool: True if number is prime, False otherwise.
26
+ """
27
+ if number <= 1:
28
+ return False
29
+ if number == 2:
30
+ return True
31
+ if number % 2 == 0:
32
+ return False
33
+ for i in range(3, isqrt(number) + 1, 2):
34
+ if number % i == 0:
35
+ return False
36
+ return True
37
+
38
+
39
+ def filter_primes(values: List[int]) -> List[int]:
40
+ """
41
+ Filter and return the prime numbers from a list.
42
+
43
+ Args:
44
+ values (List[int]): A list of integers.
45
+
46
+ Returns:
47
+ List[int]: A list containing only the prime numbers.
48
+ """
49
+ return [num for num in values if is_prime(num)]
50
+
51
+
52
+ def nth_prime(position: int) -> int:
53
+ """
54
+ Get the N-th prime number (1-based index).
55
+
56
+ Args:
57
+ position (int): The index (1-based) of the prime number to find.
58
+
59
+ Returns:
60
+ int: The N-th prime number.
61
+
62
+ Raises:
63
+ ValueError: If position < 1.
64
+ """
65
+ if position < 1:
66
+ raise ValueError("Position must be >= 1")
67
+
68
+ count = 0
69
+ candidate = 2
70
+ while True:
71
+ if is_prime(candidate):
72
+ count += 1
73
+ if count == position:
74
+ return candidate
75
+ candidate += 1
76
+
77
+
78
+ def gcd(values: List[int]) -> int:
79
+ """
80
+ Compute the greatest common divisor (GCD) of a list of integers.
81
+
82
+ Args:
83
+ values (List[int]): A list of integers.
84
+
85
+ Returns:
86
+ int: The GCD of the numbers.
87
+
88
+ Raises:
89
+ ValueError: If the list is empty.
90
+ """
91
+ if not values:
92
+ raise ValueError("Input list must not be empty")
93
+ return reduce(math.gcd, values)
94
+
95
+
96
+ def is_perfect_square(number: int) -> bool:
97
+ """
98
+ Check whether a number is a perfect square.
99
+
100
+ Args:
101
+ number (int): The number to check.
102
+
103
+ Returns:
104
+ bool: True if the number is a perfect square, False otherwise.
105
+ """
106
+ if number < 0:
107
+ return False
108
+ root = isqrt(number)
109
+ return root * root == number
110
+
111
+
112
+ def count_factors(number: int) -> List[int]:
113
+ """
114
+ Return all positive factors of a number.
115
+
116
+ Args:
117
+ number (int): The number whose factors are to be found.
118
+
119
+ Returns:
120
+ List[int]: A sorted list of factors.
121
+
122
+ Raises:
123
+ ValueError: If number is not positive.
124
+ """
125
+ if number <= 0:
126
+ raise ValueError("Number must be positive")
127
+
128
+ factors = set()
129
+ for i in range(1, isqrt(number) + 1):
130
+ if number % i == 0:
131
+ factors.add(i)
132
+ factors.add(number // i)
133
+ return sorted(factors)
134
+
135
+
136
+ def triangle_number(index: int) -> int:
137
+ """
138
+ Calculate the N-th triangular number.
139
+
140
+ Args:
141
+ index (int): The position (starting from 0) in the triangular number sequence.
142
+
143
+ Returns:
144
+ int: The N-th triangular number.
145
+
146
+ Raises:
147
+ ValueError: If index is negative.
148
+ """
149
+ if index < 0:
150
+ raise ValueError("Index must be >= 0")
151
+ return index * (index + 1) // 2
152
+
153
+
154
+ def main() -> None:
155
+ """Tester Function."""
156
+ ...
157
+
158
+
159
+ if __name__ == "__main__":
160
+ main()
@@ -0,0 +1,103 @@
1
+ Metadata-Version: 2.4
2
+ Name: pythagix
3
+ Version: 0.1.7
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
+ ---
17
+
18
+ # 📦 Pythagix
19
+
20
+ **Pythagix** is a lightweight and dependency-free Python library designed for number theory operations.
21
+ It provides a clean, efficient interface to common mathematical utilities such as prime number checks, greatest common divisor computation, triangular numbers, and more.
22
+
23
+ ---
24
+
25
+ ## 📥 Installation
26
+
27
+ Install Pythagix using pip:
28
+
29
+ ```bash
30
+ pip install pythagix
31
+ ```
32
+
33
+ ---
34
+
35
+ ## Features
36
+
37
+ * `is_prime(number: int) -> bool`
38
+ Determine whether a number is a prime number.
39
+
40
+ * `filter_primes(numbers: List[int]) -> List[int]`
41
+ Return all prime numbers from a list of integers.
42
+
43
+ * `nth_prime(position: int) -> int`
44
+ Retrieve the *n*-th prime number (1-based indexing).
45
+
46
+ * `gcd(values: List[int]) -> int`
47
+ Compute the greatest common divisor (GCD) of a list of integers.
48
+
49
+ * `is_perfect_square(number: int) -> bool`
50
+ Check whether a number is a perfect square.
51
+
52
+ * `count_factors(number: int) -> List[int]`
53
+ Return a sorted list of all positive factors of a number.
54
+
55
+ * `triangle_number(index: int) -> int`
56
+ Compute the *n*-th triangular number.
57
+
58
+ ---
59
+
60
+ ## Example Usage
61
+
62
+ ```python
63
+ from pythagix import is_prime, nth_prime, gcd, triangle_number
64
+
65
+ print(is_prime(13)) # Output: True
66
+
67
+ print(nth_prime(10)) # Output: 29
68
+
69
+ print(gcd([12, 18, 24])) # Output: 6
70
+
71
+ print(triangle_number(7)) # Output: 28
72
+ ```
73
+
74
+ ---
75
+
76
+ ## Use Cases
77
+
78
+ Pythagix is ideal for:
79
+
80
+ * Educational platforms and math-related tools
81
+
82
+ * Prototyping algorithms and number-theoretic computations
83
+
84
+ * Teaching foundational concepts in discrete mathematics and number theory
85
+
86
+ * Lightweight CLI utilities and academic scripting
87
+
88
+ ---
89
+
90
+ ## License
91
+
92
+ Pythagix is released under the [MIT License](LICENSE), making it free to use, modify, and distribute.
93
+
94
+ ---
95
+
96
+ ## Contributing
97
+
98
+ Contributions are welcome!
99
+ 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](https://github.com/your-username/pythagix).
100
+
101
+ ---
102
+
103
+ 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.
@@ -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.4",
9
+ version="0.1.7",
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.
@@ -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