diff --git a/python/p0047.py b/python/p0047.py index e185b88f..8e30fdd6 100644 --- a/python/p0047.py +++ b/python/p0047.py @@ -26,8 +26,8 @@ from itertools import count from typing import Tuple -from lib.primes import is_prime from lib.iters import groupwise +from lib.primes import is_prime @lru_cache() diff --git a/python/p0050.py b/python/p0050.py index ce3b9287..1e7c2c29 100644 --- a/python/p0050.py +++ b/python/p0050.py @@ -20,8 +20,8 @@ """ from typing import List -from lib.primes import is_prime, primes from lib.iters import groupwise +from lib.primes import is_prime, primes def main() -> int: diff --git a/python/p0055.py b/python/p0055.py index bddbe1dc..833b0b75 100644 --- a/python/p0055.py +++ b/python/p0055.py @@ -28,13 +28,14 @@ NOTE: Wording was modified slightly on 24 April 2007 to emphasise the theoretical nature of Lychrel numbers. """ from p0004 import is_palindrome + from lib.iters import digits from lib.math import from_digits def steps_to_palindrome(n: int, depth: int = 0) -> int: """Returns a 0 if the number does not reach a palindrome in 50 or fewer steps, otherwise returns the step count""" - new = n + from_digits(reversed([*digits(n)])) + new = n + from_digits(digits(n)) if is_palindrome(new): return depth + 1 elif depth == 50: diff --git a/python/p0057.py b/python/p0057.py index 44821ce6..8442901a 100644 --- a/python/p0057.py +++ b/python/p0057.py @@ -40,7 +40,7 @@ def main() -> int: answer = 0 for x in range(1_000): frac = root_two_expansion(x) - if len(digits(frac.numerator)) > len([*digits(frac.denominator)]): + if len([*digits(frac.numerator)]) > len([*digits(frac.denominator)]): answer += 1 return answer diff --git a/python/p0357.py b/python/p0357.py index 2bf94484..89b1ac2b 100644 --- a/python/p0357.py +++ b/python/p0357.py @@ -27,8 +27,8 @@ """ from typing import Iterable -from lib.primes import is_prime, primes from lib.factors import proper_divisors +from lib.primes import is_prime, primes def divisors(n: int) -> Iterable[int]: