Adopted new convention from template
This commit is contained in:
parent
60d89e8681
commit
6fd86f8cde
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
Created on 12 Sep 2021
|
||||
|
||||
@ -11,6 +11,7 @@ https://projecteuler.net/problem=47
|
||||
|
||||
from utils import timeit
|
||||
|
||||
|
||||
def factor(n):
|
||||
ans = []
|
||||
d = 2
|
||||
@ -22,27 +23,32 @@ def factor(n):
|
||||
d += 1
|
||||
if n > 1:
|
||||
ans.append(n)
|
||||
|
||||
return ans
|
||||
|
||||
|
||||
@timeit("Problem 47")
|
||||
def compute():
|
||||
"""
|
||||
The first two consecutive numbers to have two distinct prime factors are:
|
||||
|
||||
14 = 2 × 7
|
||||
15 = 3 × 5
|
||||
14 = 2 x 7
|
||||
15 = 3 x 5
|
||||
|
||||
The first three consecutive numbers to have three distinct prime factors are:
|
||||
The first three consecutive numbers to have three distinct prime factors
|
||||
are:
|
||||
|
||||
644 = 2² × 7 × 23
|
||||
645 = 3 × 5 × 43
|
||||
646 = 2 × 17 × 19.
|
||||
644 = 2² x 7 x 23
|
||||
645 = 3 x 5 x 43
|
||||
646 = 2 x 17 x 19.
|
||||
|
||||
Find the first four consecutive integers to have four distinct prime
|
||||
factors each.
|
||||
|
||||
Find the first four consecutive integers to have four distinct prime factors each.
|
||||
What is the first of these numbers?
|
||||
"""
|
||||
ans = []
|
||||
|
||||
ans = []
|
||||
for number in range(1, 1_000_000):
|
||||
if len(ans) == 4:
|
||||
break
|
||||
@ -54,7 +60,5 @@ def compute():
|
||||
return ans[0]
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
print(f"Result for Problem 47: {compute()}")
|
||||
print(f"Result for Problem 47 is {compute()}")
|
||||
|
Loading…
x
Reference in New Issue
Block a user