cryptotools/Cryptotools/lcm.py
2026-01-11 09:19:22 +01:00

34 lines
619 B
Python

#!/usr/bin/env python3
from Cryptotools.Numbers.primeNumber import gcd
def compute_multiple(a):
"""
This function compute the 20 first multiples of the number a
Args:
a (Integer): the number
Return:
list of multiple of a
"""
r = list()
for i in range(1, 20):
r.append(a * i)
return r
def lcm(a, b):
"""
This function get the LCM (Least Common Multiple) a of b
Args:
a (Integer): the number
b (Integer): the number
Return:
the LCM
"""
return (b // gcd(a, b)) * a