Use function from utils
This commit is contained in:
@@ -9,11 +9,7 @@ Solution for problem 036 of Project Euler
|
||||
https://projecteuler.net/problem=36
|
||||
"""
|
||||
|
||||
from project_euler_python.utils import timeit
|
||||
|
||||
|
||||
def is_palidrome(num):
|
||||
return str(num) == str(num)[::-1]
|
||||
from project_euler_python.utils import is_palindrome, timeit
|
||||
|
||||
|
||||
@timeit("Problem 036")
|
||||
@@ -28,7 +24,7 @@ def compute():
|
||||
|
||||
ans = 0
|
||||
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
|
||||
|
||||
return ans
|
||||
|
||||
Reference in New Issue
Block a user