Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- import time
- start = time.time()
- def f(n):
- c = 1
- Min1 = -1
- Min2 = -1
- sqrt = n**0.5
- e = n % 2 == 1
- if e:
- c += 1
- if e and (sqrt != int(sqrt) or sqrt % 2 != 1):
- return
- sqrt = int(sqrt)
- if e:
- c += 1
- for a in range(3, math.ceil(sqrt), 2):
- if n % a == 0:
- c += 2
- if Min1 == -1:
- Min1 = a
- if c > 5:
- return
- else:
- for a in range(2, sqrt + 1):
- if n % a == 0:
- j = n // a
- if j % 2 == 1:
- c += 1
- if Min1 == -1:
- Min1 = j
- elif a % 2 == 1:
- c += 1
- if Min2 == -1:
- Min2 = a
- if c > 5:
- return
- if c == 5:
- if Min1 == -1:
- Min1 = 88_888_889
- if Min2 == -1:
- Min2 = 88_888_889
- print(n, min(Min1, Min2))
- for i in range(77_777_777, 88_888_888 + 1):
- f(i)
- print(time.time() - start)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement