Adopted new convention from template
This commit is contained in:
parent
8c0f18bc5f
commit
46bbacee08
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
Created on 3 Jan 2020
|
||||
|
||||
@ -8,6 +8,7 @@ Created on 3 Jan 2020
|
||||
Solution for problem 29 of Project Euler
|
||||
https://projecteuler.net/problem=29
|
||||
"""
|
||||
from itertools import product
|
||||
|
||||
from utils import timeit
|
||||
|
||||
@ -30,9 +31,12 @@ def compute():
|
||||
How many distinct terms are in the sequence generated by ab for 2≤a≤100
|
||||
and 2≤b≤100?
|
||||
"""
|
||||
terms = set(a**b for a in range(2, 101) for b in range(2, 101))
|
||||
return len(terms)
|
||||
|
||||
ans = len(set(a**b for a, b in product(range(2, 101), repeat=2)))
|
||||
|
||||
return ans
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
print(f"Result for Problem 29: {compute()}")
|
||||
print(f"Result for Problem 29: {compute()}")
|
||||
|
Loading…
x
Reference in New Issue
Block a user