First commit

This commit is contained in:
2026-01-11 09:19:22 +01:00
commit 50f7b1159e
108 changed files with 11791 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
#!/usr/bin/env python3
+9
View File
@@ -0,0 +1,9 @@
#!/usr/bin/env python3
COMPOSITE = 0
PRIME = 1
class Number:
def __init__(self):
self._int = int()
self._kind = COMPOSITE
+34
View File
@@ -0,0 +1,34 @@
#!/usr/bin/env python3
def gcd(a, b):
"""
This function calculate the GCD (Greatest Common Divisor of the number a of b
Args:
a (Integer): the number a
b (integer): the number b
Return:
the GCD
"""
if b == 0:
return a
return gcd(b, a%b)
def egcd(a, b):
"""
This function compute the Extended Euclidean algorithm
https://user.eng.umd.edu/~danadach/Cryptography_20/ExtEuclAlg.pdf
https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm
Args:
a (Integer): the number a
b (Integer): the number b
"""
if a == 0:
return b, 0, 1
gcd, x1, y1 = egcd(b % a, a)
x = y1 - (b // a) * x1
y = x1
return gcd, x, y