-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproblem_047.py
More file actions
37 lines (24 loc) · 799 Bytes
/
Copy pathproblem_047.py
File metadata and controls
37 lines (24 loc) · 799 Bytes
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
# coding: utf-8
'''
The first two consecutive numbers to have two distinct prime factors are:
14 = 2 × 7
15 = 3 × 5
The first three consecutive numbers to have three distinct prime factors are:
644 = 2² × 7 × 23
645 = 3 × 5 × 43
646 = 2 × 17 × 19.
Find the first four consecutive integers to have four distinct prime factors. What is the first of these numbers?
'''
from helpers import prime_powers
def main():
_list_consecutive = []
for number in range(2 * 3 * 5 * 7, 10 ** 6):
if len(_list_consecutive) == 4:
return _list_consecutive[0]
if len(list(prime_powers(number))) == 4:
_list_consecutive.append(number)
else:
_list_consecutive = []
if __name__ == '__main__':
print(main())
# 134043 in 1.89s