mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-27 10:22:36 +08:00
Project Euler Solutions Added.
This commit is contained in:
15
Project Euler/Problem 04/sol1.py
Normal file
15
Project Euler/Problem 04/sol1.py
Normal file
@ -0,0 +1,15 @@
|
||||
'''
|
||||
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
|
Reference in New Issue
Block a user