Adopted new convention from template

This commit is contained in:
David Doblas Jiménez 2022-09-28 20:41:53 +02:00
parent 8c0f18bc5f
commit 46bbacee08

View File

@ -1,4 +1,4 @@
#!/usr/bin/env python3 #!/usr/bin/env python
""" """
Created on 3 Jan 2020 Created on 3 Jan 2020
@ -8,6 +8,7 @@ Created on 3 Jan 2020
Solution for problem 29 of Project Euler Solution for problem 29 of Project Euler
https://projecteuler.net/problem=29 https://projecteuler.net/problem=29
""" """
from itertools import product
from utils import timeit from utils import timeit
@ -30,8 +31,11 @@ def compute():
How many distinct terms are in the sequence generated by ab for 2a100 How many distinct terms are in the sequence generated by ab for 2a100
and 2b100? and 2b100?
""" """
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__": if __name__ == "__main__":