manin 0.0.1__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.
- manin-0.0.1/PKG-INFO +15 -0
- manin-0.0.1/README.md +4 -0
- manin-0.0.1/pyproject.toml +21 -0
- manin-0.0.1/src/nth_prime/__init__.py +3 -0
- manin-0.0.1/src/nth_prime/calculator.py +27 -0
manin-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: manin
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: A trial package that calculates the nth prime number.
|
|
5
|
+
Author-email: sbgenius <sbgenius@example.com>
|
|
6
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
7
|
+
Classifier: Operating System :: OS Independent
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Requires-Python: >=3.7
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
|
|
12
|
+
# nth-prime-sbgenius-demo
|
|
13
|
+
|
|
14
|
+
This is a trial library to demonstrate how to publish a Python package.
|
|
15
|
+
It contains a single function to calculate the nth prime number.
|
manin-0.0.1/README.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "manin"
|
|
7
|
+
version = "0.0.1"
|
|
8
|
+
authors = [
|
|
9
|
+
{ name="sbgenius", email="sbgenius@example.com" },
|
|
10
|
+
]
|
|
11
|
+
description = "A trial package that calculates the nth prime number."
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
requires-python = ">=3.7"
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"License :: OSI Approved :: MIT License",
|
|
17
|
+
"Operating System :: OS Independent",
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
[tool.hatch.build.targets.wheel]
|
|
21
|
+
packages = ["src/nth_prime"]
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
def get_nth_prime(n: int) -> int:
|
|
2
|
+
"""
|
|
3
|
+
Returns the nth prime number.
|
|
4
|
+
|
|
5
|
+
Args:
|
|
6
|
+
n (int): The position of the prime number to find (1-indexed).
|
|
7
|
+
|
|
8
|
+
Returns:
|
|
9
|
+
int: The nth prime number.
|
|
10
|
+
"""
|
|
11
|
+
if n <= 0:
|
|
12
|
+
raise ValueError("n must be a positive integer greater than 0")
|
|
13
|
+
|
|
14
|
+
primes = []
|
|
15
|
+
num = 2
|
|
16
|
+
while len(primes) < n:
|
|
17
|
+
is_prime = True
|
|
18
|
+
for p in primes:
|
|
19
|
+
if p * p > num:
|
|
20
|
+
break
|
|
21
|
+
if num % p == 0:
|
|
22
|
+
is_prime = False
|
|
23
|
+
break
|
|
24
|
+
if is_prime:
|
|
25
|
+
primes.append(num)
|
|
26
|
+
num += 1
|
|
27
|
+
return primes[-1]
|