Basic number theory tools: GCD calculation, solving linear Diophantine equations, and listing primes..
Project description
scmlab367104703
scmlab367104703 This is a basic number theory module consisting of three functions euclidean(),extended(),eratosthenes()
Features
- Euclidean Algorithm: Use
euclidean()to find the greatest common divisor (gcd) of two integers - Extended Euclidean Algorithm: Use
extended()to find - The greatest common divisor (gcd) of two numbers
aandb - And two numbers
xandysuch that:
[ a \times x + b \times y = \gcd(a, b) ]
- Sieve of Eratosthenes:Use
eratosthenes(n)to find all prime numbers up to a certainn.
Installation
You can install the package directly from PyPI:
pip install scmlab367104703
Example1(Euclidean Algorithm)
#input
>>>import scmlab367104703 as scm
>>> scm.euclidean(807, 481)
#output
gcd(807, 481)
807 = 481 x 1 + 326
481 = 326 x 1 + 155
326 = 155 x 2 + 16
155 = 16 x 9 + 11
16 = 11 x 1 + 5
11 = 5 x 2 + 1
5 = 1 x 5 + 0
gcd is 1
Example2(Extended Euclidean Algorithm)
#input
>>> import scmlab367104703 as scm
>>> scm.extended(120, 23)
#output
120*(-9) + 23*(47) = 1
x = -9, y = 47
Example3(Sieve of Eratosthenes)
#input
>>> import scmlab367104703 as scm
>>> scm.eratosthenes(50)
#output
+------+-----+------+----+-----+----+------+----+------+----+
| 1 | *2* | *3* | 4 | *5* | 6 | *7* | 8 | 9 | 10 |
| *11* | 12 | *13* | 14 | 15 | 16 | *17* | 18 | *19* | 20 |
| 21 | 22 | *23* | 24 | 25 | 26 | 27 | 28 | *29* | 30 |
| *31* | 32 | 33 | 34 | 35 | 36 | *37* | 38 | 39 | 40 |
| *41* | 42 | *43* | 44 | 45 | 46 | *47* | 48 | 49 | 50 |
+------+-----+------+----+-----+----+------+----+------+----+
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scmlab367104703-0.1.0.tar.gz.
File metadata
- Download URL: scmlab367104703-0.1.0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
448c6378cbab09061432049776da9c41c24c3d18bfa138c05ff6a12751324a29
|
|
| MD5 |
cb9b996db023e2be37b756c7b1230796
|
|
| BLAKE2b-256 |
e16fd0e52939b1743bcccab2282e60b463e5e9a42170a738a05c4b77e5097d35
|
File details
Details for the file scmlab367104703-0.1.0-py3-none-any.whl.
File metadata
- Download URL: scmlab367104703-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
141c069eecbabbcaf41945ce76d6c8bdf89c2ec0c43230757d6aceeff9f1ca83
|
|
| MD5 |
1b987e9580dad389d3985ccfe60d8f3f
|
|
| BLAKE2b-256 |
57eb93bfc505be21d930264d4053bcd1955521bd8d386319adaef6669b79a41f
|