Largest Palindrome Product¶
Our search space is only $\binom{900}{2} = 404550$ 3-digit pairs - a lot to check by hand but peanuts to a modern computer (we're using notation for combinations if you're unfamiliar).
In [1]:
from itertools import combinations
is_palindrome = lambda x: str(x) == str(x)[::-1]
three_digit_pairs = combinations(range(100, 1000), 2)
max(x*y for (x,y) in three_digit_pairs if is_palindrome(x*y))
Out[1]:
906609
Copyright (C) 2025 filifa¶
This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International license and the BSD Zero Clause license.