Use function from utils

This commit is contained in:
2026-04-18 15:30:48 +02:00
parent 233fc85708
commit e6ed590b73

View File

@@ -9,11 +9,7 @@ Solution for problem 036 of Project Euler
https://projecteuler.net/problem=36 https://projecteuler.net/problem=36
""" """
from project_euler_python.utils import timeit from project_euler_python.utils import is_palindrome, timeit
def is_palidrome(num):
return str(num) == str(num)[::-1]
@timeit("Problem 036") @timeit("Problem 036")
@@ -28,7 +24,7 @@ def compute():
ans = 0 ans = 0
for i in range(1, 1_000_001, 2): for i in range(1, 1_000_001, 2):
if is_palidrome(i) and is_palidrome(bin(i)[2:]): if is_palindrome(i) and is_palindrome(bin(i)[2:]):
ans += i ans += i
return ans return ans