-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path005.py
58 lines (40 loc) · 919 Bytes
/
005.py
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
51
52
53
54
# !/usr/bin/python3
# -*- coding: utf-8 -*-
import time
print(f'-----------------------4--')
def euler5(limit):
found = False
z = 1
n = limit
while not found:
# print(n)
found = True
for i in range(2, limit+1):
if not n % i == 0:
found = False
break
z += 1
n = limit * z
# if any(n % i != 0 for i in range(2, limit+1)):
# z += 1
# n = limit * z
# else:
# return n
return n
t1 = time.perf_counter_ns()
print(euler5(20), (time.perf_counter_ns() - t1)/1000000000)
# def euler5(limit):
#
# limit += 1
# iterator = 1
#
# while True:
# num = limit * iterator
#
# for divider in range(2, limit):
# if num % divider != 0:
# break
# else:
# return num
#
# iterator += 1