Project Euler #4: Largest palindrome product

  • + 0 comments

    def is_palindrome(n): return str(n) == str(n)[::-1] def checker(k): for i in range(999, 99, -1):
    if k % i == 0 and 100 <= k // i <= 999: return True return False

    def main(): t = int(input()) for _ in range(t): n = int(input()) for i in range(n - 1, 101101 - 1, -1): if is_palindrome(i) and checker(i): print(i) break

    if name == "main": main()