You are viewing a single comment's thread. Return to all comments →
Python 3:
#!/bin/python3 import sys def isPalindrome(num): return num == int(str(num)[::-1]) def checkIfProduct(num): for i in range(100, 1000): if (num % i == 0): x = num / i if (x < 1000 and x >= 100): return True return False t = int(input().strip()) for a0 in range(t): n = int(input().strip()) for i in range(n-1, 100000, -1): if isPalindrome(i): if checkIfProduct(i): print(i) break
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #4: Largest palindrome product
You are viewing a single comment's thread. Return to all comments →
Python 3: