38 lines
528 B
Python
38 lines
528 B
Python
import os
|
|
import numpy
|
|
|
|
|
|
# Find the smallest number that is divisible by all numbers from 1 to 20
|
|
|
|
|
|
def isDivisible(n, ms):
|
|
res = True
|
|
|
|
for m in ms:
|
|
if n % m != 0:
|
|
res = False
|
|
break
|
|
|
|
return res
|
|
|
|
|
|
def findSmallestDivBy(ns):
|
|
res = 1
|
|
|
|
while not isDivisible(res, ns):
|
|
res = res + 1
|
|
|
|
return res
|
|
|
|
|
|
|
|
def main():
|
|
print("Hello, this is Patrick")
|
|
|
|
x = findSmallestDivBy([2, 3, 4, 5, 7, 8, 9, 11, 13, 16, 17, 19])
|
|
print(x)
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main() |