pythagix 0.1.6__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,6 +1,6 @@
1
1
  [project]
2
2
  name = "pythagix"
3
- version = "0.1.6"
3
+ version = "0.1.7"
4
4
  description = "A mathy Python package with utilities like LCM, triangle numbers, etc."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.6"
@@ -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.6",
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.6/PKG-INFO DELETED
@@ -1,56 +0,0 @@
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 DELETED
@@ -1,41 +0,0 @@
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,98 +0,0 @@
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()
@@ -1,56 +0,0 @@
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.
File without changes
File without changes
File without changes
File without changes