pythagix 0.2.0__tar.gz → 0.2.2__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.2.2/PKG-INFO +100 -0
- pythagix-0.2.2/README.md +85 -0
- {pythagix-0.2.0 → pythagix-0.2.2}/pyproject.toml +1 -1
- {pythagix-0.2.0 → pythagix-0.2.2}/pythagix/__init__.py +3 -0
- {pythagix-0.2.0 → pythagix-0.2.2}/pythagix/core.py +99 -19
- pythagix-0.2.2/pythagix.egg-info/PKG-INFO +100 -0
- {pythagix-0.2.0 → pythagix-0.2.2}/setup.py +1 -1
- pythagix-0.2.0/PKG-INFO +0 -112
- pythagix-0.2.0/README.md +0 -97
- pythagix-0.2.0/pythagix.egg-info/PKG-INFO +0 -112
- {pythagix-0.2.0 → pythagix-0.2.2}/LICENSE +0 -0
- {pythagix-0.2.0 → pythagix-0.2.2}/MANIFEST.in +0 -0
- {pythagix-0.2.0 → pythagix-0.2.2}/pythagix.egg-info/SOURCES.txt +0 -0
- {pythagix-0.2.0 → pythagix-0.2.2}/pythagix.egg-info/dependency_links.txt +0 -0
- {pythagix-0.2.0 → pythagix-0.2.2}/pythagix.egg-info/top_level.txt +0 -0
- {pythagix-0.2.0 → pythagix-0.2.2}/setup.cfg +0 -0
pythagix-0.2.2/PKG-INFO
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: pythagix
|
3
|
+
Version: 0.2.2
|
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, dependency-free Python library for number theory operations.
|
19
|
+
It provides a clean and efficient interface for common mathematical utilities such as prime checking, greatest common divisor, triangular numbers, and more.
|
20
|
+
|
21
|
+
---
|
22
|
+
|
23
|
+
|
24
|
+
Installation
|
25
|
+
|
26
|
+
You can install Pythagix using pip:
|
27
|
+
|
28
|
+
```bash
|
29
|
+
pip install pythagix
|
30
|
+
```
|
31
|
+
|
32
|
+
|
33
|
+
Features
|
34
|
+
|
35
|
+
count_factors(number: int) -> List[int]
|
36
|
+
Returns a sorted list of all positive factors of the given number.
|
37
|
+
|
38
|
+
digit_sum(number: int) -> int
|
39
|
+
Returns the sum of all digits in the given number.
|
40
|
+
|
41
|
+
filter_primes(values: List[int]) -> List[int]
|
42
|
+
Filters and returns prime numbers from a list of integers.
|
43
|
+
|
44
|
+
gcd(values: List[int]) -> int
|
45
|
+
Computes the greatest common divisor (GCD) of a list of integers.
|
46
|
+
|
47
|
+
is_perfect_square(number: int) -> bool
|
48
|
+
Determines whether a number is a perfect square.
|
49
|
+
|
50
|
+
is_prime(number: int) -> bool
|
51
|
+
Checks whether a number is prime.
|
52
|
+
|
53
|
+
is_multiple(number: int, base: int) -> bool
|
54
|
+
Checks if one number is a multiple of another.
|
55
|
+
|
56
|
+
lcm(values: List[int]) -> int
|
57
|
+
Computes the least common multiple (LCM) of a list of integers.
|
58
|
+
|
59
|
+
mean(values: List[int | float]) -> float
|
60
|
+
Calculates the arithmetic mean (average) of a list of numbers.
|
61
|
+
|
62
|
+
median(values: List[int | float]) -> float
|
63
|
+
Computes the median value of a list.
|
64
|
+
|
65
|
+
middle(a: int | float, b: int | float) -> float
|
66
|
+
Returns the midpoint of two numeric values.
|
67
|
+
|
68
|
+
mode(values: List[int | float]) -> int | float | List[int | float]
|
69
|
+
Computes the mode(s) of a list. Returns a single value or a list of modes.
|
70
|
+
|
71
|
+
nth_prime(position: int) -> int
|
72
|
+
Retrieves the n-th prime number (1-based index).
|
73
|
+
|
74
|
+
triangle_number(index: int) -> int
|
75
|
+
Computes the n-th triangular number.
|
76
|
+
|
77
|
+
|
78
|
+
Use Cases
|
79
|
+
|
80
|
+
Pythagix is suitable for:
|
81
|
+
|
82
|
+
Educational platforms and math-related applications
|
83
|
+
|
84
|
+
Prototyping number-theoretic algorithms
|
85
|
+
|
86
|
+
Teaching foundational concepts in discrete mathematics
|
87
|
+
|
88
|
+
Lightweight command-line tools and academic scripting
|
89
|
+
|
90
|
+
|
91
|
+
License
|
92
|
+
|
93
|
+
This project is licensed under the MIT License.
|
94
|
+
You are free to use, modify, and distribute the software as permitted under the license terms.
|
95
|
+
|
96
|
+
Contributing
|
97
|
+
|
98
|
+
Contributions are welcome.
|
99
|
+
|
100
|
+
To report bugs, suggest enhancements, or submit code improvements, please open an issue or create a pull request via the GitHub repository.
|
pythagix-0.2.2/README.md
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
# Pythagix
|
2
|
+
|
3
|
+
Pythagix is a lightweight, dependency-free Python library for number theory operations.
|
4
|
+
It provides a clean and efficient interface for common mathematical utilities such as prime checking, greatest common divisor, triangular numbers, and more.
|
5
|
+
|
6
|
+
---
|
7
|
+
|
8
|
+
|
9
|
+
Installation
|
10
|
+
|
11
|
+
You can install Pythagix using pip:
|
12
|
+
|
13
|
+
```bash
|
14
|
+
pip install pythagix
|
15
|
+
```
|
16
|
+
|
17
|
+
|
18
|
+
Features
|
19
|
+
|
20
|
+
count_factors(number: int) -> List[int]
|
21
|
+
Returns a sorted list of all positive factors of the given number.
|
22
|
+
|
23
|
+
digit_sum(number: int) -> int
|
24
|
+
Returns the sum of all digits in the given number.
|
25
|
+
|
26
|
+
filter_primes(values: List[int]) -> List[int]
|
27
|
+
Filters and returns prime numbers from a list of integers.
|
28
|
+
|
29
|
+
gcd(values: List[int]) -> int
|
30
|
+
Computes the greatest common divisor (GCD) of a list of integers.
|
31
|
+
|
32
|
+
is_perfect_square(number: int) -> bool
|
33
|
+
Determines whether a number is a perfect square.
|
34
|
+
|
35
|
+
is_prime(number: int) -> bool
|
36
|
+
Checks whether a number is prime.
|
37
|
+
|
38
|
+
is_multiple(number: int, base: int) -> bool
|
39
|
+
Checks if one number is a multiple of another.
|
40
|
+
|
41
|
+
lcm(values: List[int]) -> int
|
42
|
+
Computes the least common multiple (LCM) of a list of integers.
|
43
|
+
|
44
|
+
mean(values: List[int | float]) -> float
|
45
|
+
Calculates the arithmetic mean (average) of a list of numbers.
|
46
|
+
|
47
|
+
median(values: List[int | float]) -> float
|
48
|
+
Computes the median value of a list.
|
49
|
+
|
50
|
+
middle(a: int | float, b: int | float) -> float
|
51
|
+
Returns the midpoint of two numeric values.
|
52
|
+
|
53
|
+
mode(values: List[int | float]) -> int | float | List[int | float]
|
54
|
+
Computes the mode(s) of a list. Returns a single value or a list of modes.
|
55
|
+
|
56
|
+
nth_prime(position: int) -> int
|
57
|
+
Retrieves the n-th prime number (1-based index).
|
58
|
+
|
59
|
+
triangle_number(index: int) -> int
|
60
|
+
Computes the n-th triangular number.
|
61
|
+
|
62
|
+
|
63
|
+
Use Cases
|
64
|
+
|
65
|
+
Pythagix is suitable for:
|
66
|
+
|
67
|
+
Educational platforms and math-related applications
|
68
|
+
|
69
|
+
Prototyping number-theoretic algorithms
|
70
|
+
|
71
|
+
Teaching foundational concepts in discrete mathematics
|
72
|
+
|
73
|
+
Lightweight command-line tools and academic scripting
|
74
|
+
|
75
|
+
|
76
|
+
License
|
77
|
+
|
78
|
+
This project is licensed under the MIT License.
|
79
|
+
You are free to use, modify, and distribute the software as permitted under the license terms.
|
80
|
+
|
81
|
+
Contributing
|
82
|
+
|
83
|
+
Contributions are welcome.
|
84
|
+
|
85
|
+
To report bugs, suggest enhancements, or submit code improvements, please open an issue or create a pull request via the GitHub repository.
|
@@ -1,6 +1,9 @@
|
|
1
1
|
import math as m
|
2
2
|
from functools import reduce
|
3
|
-
from typing import List
|
3
|
+
from typing import List, Union
|
4
|
+
from collections import Counter
|
5
|
+
|
6
|
+
Numeric = Union[int, float]
|
4
7
|
|
5
8
|
__all__ = [
|
6
9
|
"count_factors",
|
@@ -11,7 +14,10 @@ __all__ = [
|
|
11
14
|
"is_prime",
|
12
15
|
"is_multiple",
|
13
16
|
"lcm",
|
17
|
+
"mean",
|
18
|
+
"median",
|
14
19
|
"middle",
|
20
|
+
"mode",
|
15
21
|
"nth_prime",
|
16
22
|
"triangle_number",
|
17
23
|
]
|
@@ -25,7 +31,7 @@ def is_prime(number: int) -> bool:
|
|
25
31
|
number (int): The number to check.
|
26
32
|
|
27
33
|
Returns:
|
28
|
-
bool: True if number is prime, False otherwise.
|
34
|
+
bool: True if the number is prime, False otherwise.
|
29
35
|
"""
|
30
36
|
if number <= 1:
|
31
37
|
return False
|
@@ -123,7 +129,7 @@ def count_factors(number: int) -> List[int]:
|
|
123
129
|
List[int]: A sorted list of factors.
|
124
130
|
|
125
131
|
Raises:
|
126
|
-
ValueError: If number is not positive.
|
132
|
+
ValueError: If the number is not positive.
|
127
133
|
"""
|
128
134
|
if number <= 0:
|
129
135
|
raise ValueError("Number must be positive")
|
@@ -147,7 +153,7 @@ def triangle_number(index: int) -> int:
|
|
147
153
|
int: The N-th triangular number.
|
148
154
|
|
149
155
|
Raises:
|
150
|
-
ValueError: If index is negative.
|
156
|
+
ValueError: If the index is negative.
|
151
157
|
"""
|
152
158
|
if index < 0:
|
153
159
|
raise ValueError("Index must be >= 0")
|
@@ -168,23 +174,22 @@ def lcm(values: List[int]) -> int:
|
|
168
174
|
ValueError: If the list is empty.
|
169
175
|
"""
|
170
176
|
if not values:
|
171
|
-
raise ValueError("Input list must not empty")
|
177
|
+
raise ValueError("Input list must not be empty")
|
172
178
|
|
173
179
|
return reduce(m.lcm, values)
|
174
180
|
|
175
181
|
|
176
182
|
def digit_sum(number: int) -> int:
|
177
183
|
"""
|
178
|
-
Sum all digits
|
184
|
+
Sum all digits of the given number.
|
179
185
|
|
180
186
|
Args:
|
181
187
|
number (int): The number whose digits are to be summed.
|
182
188
|
|
183
189
|
Returns:
|
184
|
-
int: The sum of the digits in the number
|
190
|
+
int: The sum of the digits in the number.
|
185
191
|
"""
|
186
|
-
|
187
|
-
return sum([int(digit) for digit in str(number)])
|
192
|
+
return sum(int(digit) for digit in str(number))
|
188
193
|
|
189
194
|
|
190
195
|
def is_multiple(number: int, base: int) -> bool:
|
@@ -192,35 +197,110 @@ def is_multiple(number: int, base: int) -> bool:
|
|
192
197
|
Check if a number is a multiple of another number.
|
193
198
|
|
194
199
|
Args:
|
195
|
-
|
200
|
+
number (int): The number to test.
|
196
201
|
base (int): The base to check against.
|
197
202
|
|
198
203
|
Returns:
|
199
|
-
bool: True if
|
204
|
+
bool: True if number is a multiple of base, False otherwise.
|
200
205
|
"""
|
201
|
-
|
202
206
|
return number % base == 0
|
203
207
|
|
204
208
|
|
205
|
-
def middle(a:
|
209
|
+
def middle(a: Numeric, b: Numeric) -> float:
|
206
210
|
"""
|
207
211
|
Return the midpoint between two numbers.
|
208
212
|
|
209
213
|
Args:
|
210
|
-
a (float): The first number.
|
211
|
-
b (float): The second number.
|
214
|
+
a (int | float): The first number.
|
215
|
+
b (int | float): The second number.
|
212
216
|
|
213
217
|
Returns:
|
214
218
|
float: The average of the two numbers.
|
215
219
|
"""
|
216
|
-
|
217
220
|
return (a + b) / 2
|
218
221
|
|
219
222
|
|
220
|
-
def
|
221
|
-
"""
|
222
|
-
|
223
|
+
def mean(values: List[Numeric]) -> float:
|
224
|
+
"""
|
225
|
+
Calculate the mean (average) of a list of numbers.
|
226
|
+
|
227
|
+
Args:
|
228
|
+
values (List[int | float]): A list of integers or floats.
|
229
|
+
|
230
|
+
Returns:
|
231
|
+
float: The mean of the list.
|
232
|
+
|
233
|
+
Raises:
|
234
|
+
ValueError: If the input list is empty.
|
235
|
+
"""
|
236
|
+
if not values:
|
237
|
+
raise ValueError("Must contain at least one data point")
|
238
|
+
|
239
|
+
total = 0
|
240
|
+
for number in values:
|
241
|
+
total += number
|
242
|
+
|
243
|
+
return total / len(values)
|
244
|
+
|
245
|
+
|
246
|
+
def median(values: List[Numeric]) -> float:
|
247
|
+
"""
|
248
|
+
Calculate the median of a list of numbers.
|
249
|
+
|
250
|
+
Args:
|
251
|
+
values (List[int | float]): A list of integers or floats.
|
252
|
+
|
253
|
+
Returns:
|
254
|
+
float: The median of the list.
|
255
|
+
|
256
|
+
Raises:
|
257
|
+
ValueError: If the input list is empty.
|
258
|
+
"""
|
259
|
+
if not values:
|
260
|
+
raise ValueError("Must contain at least one data point")
|
261
|
+
|
262
|
+
values = sorted(values)
|
263
|
+
length = len(values)
|
264
|
+
mid = length // 2
|
265
|
+
|
266
|
+
if length % 2 == 1:
|
267
|
+
return float(values[mid])
|
268
|
+
else:
|
269
|
+
return middle(values[mid - 1], values[mid])
|
270
|
+
|
271
|
+
|
272
|
+
def mode(values: List[Numeric]) -> Union[Numeric, List[Numeric]]:
|
273
|
+
"""
|
274
|
+
Compute the mode(s) of a list of numeric values.
|
275
|
+
|
276
|
+
The mode is the number that appears most frequently in the list.
|
277
|
+
If multiple numbers have the same highest frequency, all such numbers are returned as a list.
|
278
|
+
If only one number has the highest frequency, that single value is returned.
|
279
|
+
|
280
|
+
Args:
|
281
|
+
values (List[int | float]): A list of integers or floats.
|
282
|
+
|
283
|
+
Returns:
|
284
|
+
int | float | List[int | float]:
|
285
|
+
The mode of the list. Returns a single value if there's one mode,
|
286
|
+
or a list of values if multiple modes exist.
|
287
|
+
|
288
|
+
Raises:
|
289
|
+
ValueError: If the input list is empty.
|
290
|
+
"""
|
291
|
+
if not values:
|
292
|
+
raise ValueError("Input list must not be empty")
|
293
|
+
|
294
|
+
frequency = Counter(values)
|
295
|
+
highest = max(frequency.values())
|
296
|
+
modes = [number for number, count in frequency.items() if count == highest]
|
297
|
+
|
298
|
+
return modes[0] if len(modes) == 1 else modes
|
223
299
|
|
224
300
|
|
225
301
|
if __name__ == "__main__":
|
302
|
+
|
303
|
+
def main() -> None:
|
304
|
+
"""Tester Function."""
|
305
|
+
|
226
306
|
main()
|
@@ -0,0 +1,100 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: pythagix
|
3
|
+
Version: 0.2.2
|
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, dependency-free Python library for number theory operations.
|
19
|
+
It provides a clean and efficient interface for common mathematical utilities such as prime checking, greatest common divisor, triangular numbers, and more.
|
20
|
+
|
21
|
+
---
|
22
|
+
|
23
|
+
|
24
|
+
Installation
|
25
|
+
|
26
|
+
You can install Pythagix using pip:
|
27
|
+
|
28
|
+
```bash
|
29
|
+
pip install pythagix
|
30
|
+
```
|
31
|
+
|
32
|
+
|
33
|
+
Features
|
34
|
+
|
35
|
+
count_factors(number: int) -> List[int]
|
36
|
+
Returns a sorted list of all positive factors of the given number.
|
37
|
+
|
38
|
+
digit_sum(number: int) -> int
|
39
|
+
Returns the sum of all digits in the given number.
|
40
|
+
|
41
|
+
filter_primes(values: List[int]) -> List[int]
|
42
|
+
Filters and returns prime numbers from a list of integers.
|
43
|
+
|
44
|
+
gcd(values: List[int]) -> int
|
45
|
+
Computes the greatest common divisor (GCD) of a list of integers.
|
46
|
+
|
47
|
+
is_perfect_square(number: int) -> bool
|
48
|
+
Determines whether a number is a perfect square.
|
49
|
+
|
50
|
+
is_prime(number: int) -> bool
|
51
|
+
Checks whether a number is prime.
|
52
|
+
|
53
|
+
is_multiple(number: int, base: int) -> bool
|
54
|
+
Checks if one number is a multiple of another.
|
55
|
+
|
56
|
+
lcm(values: List[int]) -> int
|
57
|
+
Computes the least common multiple (LCM) of a list of integers.
|
58
|
+
|
59
|
+
mean(values: List[int | float]) -> float
|
60
|
+
Calculates the arithmetic mean (average) of a list of numbers.
|
61
|
+
|
62
|
+
median(values: List[int | float]) -> float
|
63
|
+
Computes the median value of a list.
|
64
|
+
|
65
|
+
middle(a: int | float, b: int | float) -> float
|
66
|
+
Returns the midpoint of two numeric values.
|
67
|
+
|
68
|
+
mode(values: List[int | float]) -> int | float | List[int | float]
|
69
|
+
Computes the mode(s) of a list. Returns a single value or a list of modes.
|
70
|
+
|
71
|
+
nth_prime(position: int) -> int
|
72
|
+
Retrieves the n-th prime number (1-based index).
|
73
|
+
|
74
|
+
triangle_number(index: int) -> int
|
75
|
+
Computes the n-th triangular number.
|
76
|
+
|
77
|
+
|
78
|
+
Use Cases
|
79
|
+
|
80
|
+
Pythagix is suitable for:
|
81
|
+
|
82
|
+
Educational platforms and math-related applications
|
83
|
+
|
84
|
+
Prototyping number-theoretic algorithms
|
85
|
+
|
86
|
+
Teaching foundational concepts in discrete mathematics
|
87
|
+
|
88
|
+
Lightweight command-line tools and academic scripting
|
89
|
+
|
90
|
+
|
91
|
+
License
|
92
|
+
|
93
|
+
This project is licensed under the MIT License.
|
94
|
+
You are free to use, modify, and distribute the software as permitted under the license terms.
|
95
|
+
|
96
|
+
Contributing
|
97
|
+
|
98
|
+
Contributions are welcome.
|
99
|
+
|
100
|
+
To report bugs, suggest enhancements, or submit code improvements, please open an issue or create a pull request via the GitHub repository.
|
@@ -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.2.
|
9
|
+
version="0.2.2",
|
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.2.0/PKG-INFO
DELETED
@@ -1,112 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.4
|
2
|
-
Name: pythagix
|
3
|
-
Version: 0.2.0
|
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
|
-
count_factors(number: int) -> List[int]
|
38
|
-
Return a sorted list of all positive factors of the given number.
|
39
|
-
|
40
|
-
digit_sum(number: int) -> int
|
41
|
-
Return the sum of all digit in the given number.
|
42
|
-
|
43
|
-
filter_primes(numbers: List[int]) -> List[int]
|
44
|
-
Return all prime numbers from a list of integers.
|
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
|
-
is_prime(number: int) -> bool
|
53
|
-
Determine whether a number is prime.
|
54
|
-
|
55
|
-
lcm(values: List[int]) -> int
|
56
|
-
Compute the least common multiple (LCM) of a list of integers.
|
57
|
-
|
58
|
-
middle(a: int | float, b: int | float) -> float
|
59
|
-
Return the midpoint of two numbers.
|
60
|
-
|
61
|
-
nth_prime(position: int) -> int
|
62
|
-
Retrieve the n-th prime number (1-based index).
|
63
|
-
|
64
|
-
triangle_number(index: int) -> int
|
65
|
-
Compute the n-th triangular number.
|
66
|
-
|
67
|
-
---
|
68
|
-
|
69
|
-
## Example Usage
|
70
|
-
|
71
|
-
```python
|
72
|
-
from pythagix import is_prime, nth_prime, gcd, triangle_number
|
73
|
-
|
74
|
-
print(is_prime(13)) # Output: True
|
75
|
-
|
76
|
-
print(nth_prime(10)) # Output: 29
|
77
|
-
|
78
|
-
print(gcd([12, 18, 24])) # Output: 6
|
79
|
-
|
80
|
-
print(triangle_number(7)) # Output: 28
|
81
|
-
```
|
82
|
-
|
83
|
-
---
|
84
|
-
|
85
|
-
## Use Cases
|
86
|
-
|
87
|
-
Pythagix is ideal for:
|
88
|
-
|
89
|
-
Educational platforms and math-related tools
|
90
|
-
|
91
|
-
Prototyping algorithms and number-theoretic computations
|
92
|
-
|
93
|
-
Teaching foundational concepts in discrete mathematics and number theory
|
94
|
-
|
95
|
-
Lightweight CLI utilities and academic scripting
|
96
|
-
|
97
|
-
---
|
98
|
-
|
99
|
-
## License
|
100
|
-
|
101
|
-
Pythagix is released under the [MIT License](LICENSE), making it free to use, modify, and distribute.
|
102
|
-
|
103
|
-
---
|
104
|
-
|
105
|
-
## Contributing
|
106
|
-
|
107
|
-
Contributions are welcome!
|
108
|
-
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).
|
109
|
-
|
110
|
-
---
|
111
|
-
|
112
|
-
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.
|
pythagix-0.2.0/README.md
DELETED
@@ -1,97 +0,0 @@
|
|
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
|
-
count_factors(number: int) -> List[int]
|
23
|
-
Return a sorted list of all positive factors of the given number.
|
24
|
-
|
25
|
-
digit_sum(number: int) -> int
|
26
|
-
Return the sum of all digit in the given number.
|
27
|
-
|
28
|
-
filter_primes(numbers: List[int]) -> List[int]
|
29
|
-
Return all prime numbers from a list of integers.
|
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
|
-
is_prime(number: int) -> bool
|
38
|
-
Determine whether a number is prime.
|
39
|
-
|
40
|
-
lcm(values: List[int]) -> int
|
41
|
-
Compute the least common multiple (LCM) of a list of integers.
|
42
|
-
|
43
|
-
middle(a: int | float, b: int | float) -> float
|
44
|
-
Return the midpoint of two numbers.
|
45
|
-
|
46
|
-
nth_prime(position: int) -> int
|
47
|
-
Retrieve the n-th prime number (1-based index).
|
48
|
-
|
49
|
-
triangle_number(index: int) -> int
|
50
|
-
Compute the n-th triangular number.
|
51
|
-
|
52
|
-
---
|
53
|
-
|
54
|
-
## Example Usage
|
55
|
-
|
56
|
-
```python
|
57
|
-
from pythagix import is_prime, nth_prime, gcd, triangle_number
|
58
|
-
|
59
|
-
print(is_prime(13)) # Output: True
|
60
|
-
|
61
|
-
print(nth_prime(10)) # Output: 29
|
62
|
-
|
63
|
-
print(gcd([12, 18, 24])) # Output: 6
|
64
|
-
|
65
|
-
print(triangle_number(7)) # Output: 28
|
66
|
-
```
|
67
|
-
|
68
|
-
---
|
69
|
-
|
70
|
-
## Use Cases
|
71
|
-
|
72
|
-
Pythagix is ideal for:
|
73
|
-
|
74
|
-
Educational platforms and math-related tools
|
75
|
-
|
76
|
-
Prototyping algorithms and number-theoretic computations
|
77
|
-
|
78
|
-
Teaching foundational concepts in discrete mathematics and number theory
|
79
|
-
|
80
|
-
Lightweight CLI utilities and academic scripting
|
81
|
-
|
82
|
-
---
|
83
|
-
|
84
|
-
## License
|
85
|
-
|
86
|
-
Pythagix is released under the [MIT License](LICENSE), making it free to use, modify, and distribute.
|
87
|
-
|
88
|
-
---
|
89
|
-
|
90
|
-
## Contributing
|
91
|
-
|
92
|
-
Contributions are welcome!
|
93
|
-
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).
|
94
|
-
|
95
|
-
---
|
96
|
-
|
97
|
-
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,112 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.4
|
2
|
-
Name: pythagix
|
3
|
-
Version: 0.2.0
|
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
|
-
count_factors(number: int) -> List[int]
|
38
|
-
Return a sorted list of all positive factors of the given number.
|
39
|
-
|
40
|
-
digit_sum(number: int) -> int
|
41
|
-
Return the sum of all digit in the given number.
|
42
|
-
|
43
|
-
filter_primes(numbers: List[int]) -> List[int]
|
44
|
-
Return all prime numbers from a list of integers.
|
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
|
-
is_prime(number: int) -> bool
|
53
|
-
Determine whether a number is prime.
|
54
|
-
|
55
|
-
lcm(values: List[int]) -> int
|
56
|
-
Compute the least common multiple (LCM) of a list of integers.
|
57
|
-
|
58
|
-
middle(a: int | float, b: int | float) -> float
|
59
|
-
Return the midpoint of two numbers.
|
60
|
-
|
61
|
-
nth_prime(position: int) -> int
|
62
|
-
Retrieve the n-th prime number (1-based index).
|
63
|
-
|
64
|
-
triangle_number(index: int) -> int
|
65
|
-
Compute the n-th triangular number.
|
66
|
-
|
67
|
-
---
|
68
|
-
|
69
|
-
## Example Usage
|
70
|
-
|
71
|
-
```python
|
72
|
-
from pythagix import is_prime, nth_prime, gcd, triangle_number
|
73
|
-
|
74
|
-
print(is_prime(13)) # Output: True
|
75
|
-
|
76
|
-
print(nth_prime(10)) # Output: 29
|
77
|
-
|
78
|
-
print(gcd([12, 18, 24])) # Output: 6
|
79
|
-
|
80
|
-
print(triangle_number(7)) # Output: 28
|
81
|
-
```
|
82
|
-
|
83
|
-
---
|
84
|
-
|
85
|
-
## Use Cases
|
86
|
-
|
87
|
-
Pythagix is ideal for:
|
88
|
-
|
89
|
-
Educational platforms and math-related tools
|
90
|
-
|
91
|
-
Prototyping algorithms and number-theoretic computations
|
92
|
-
|
93
|
-
Teaching foundational concepts in discrete mathematics and number theory
|
94
|
-
|
95
|
-
Lightweight CLI utilities and academic scripting
|
96
|
-
|
97
|
-
---
|
98
|
-
|
99
|
-
## License
|
100
|
-
|
101
|
-
Pythagix is released under the [MIT License](LICENSE), making it free to use, modify, and distribute.
|
102
|
-
|
103
|
-
---
|
104
|
-
|
105
|
-
## Contributing
|
106
|
-
|
107
|
-
Contributions are welcome!
|
108
|
-
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).
|
109
|
-
|
110
|
-
---
|
111
|
-
|
112
|
-
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.
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|