Python/Project Euler/Problem 04/sol1.py
2017-10-24 21:11:19 +05:30

16 lines
483 B
Python

'''
Problem:
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 x 99.
Find the largest palindrome made from the product of two 3-digit numbers which is less than N.
'''
n=int(input())
for i in range(n-1,10000,-1):
temp=str(i)
if(temp==temp[::-1]):
j=999
while(j!=99):
if((i%j==0) and (len(str(i/j))==3)):
print i
exit(0)
j-=1