Skip to content
Snippets Groups Projects
Commit 38cdacc5 authored by adrian.spycher's avatar adrian.spycher
Browse files

add comment

parent a9b9718a
No related branches found
No related tags found
No related merge requests found
......@@ -79,7 +79,7 @@ def exponentiation_rapide(a, exp, n):
def is_square(a):
"""Check if a number is a perfect square, based on the "Babylonian algorithm" for square root,
"""Check if a number is a perfect square, based on the "Babylonian algorithm" (Héron's method) for square root,
from : https://stackoverflow.com/questions/2489435/check-if-a-number-is-a-perfect-square
Args:
......@@ -93,7 +93,7 @@ def is_square(a):
seen = set([x])
while x * x != a:
x = (x + (a // x)) // 2
x = (x + (a // x)) // 2 # arithmetic average
if x in seen:
return False
......@@ -131,6 +131,7 @@ def fermat_factorization(n):
b = int(math.sqrt(b2))
return (a, b)
def decode_msg(M):
"""Decode a code UTF-8 in characters
from : Niklaus Eggenberg
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment