-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path004.py
More file actions
17 lines (15 loc) · 702 Bytes
/
004.py
File metadata and controls
17 lines (15 loc) · 702 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import math
def ispalindrome(nmbr):
if nmbr < 100000:
if math.floor(nmbr/10000) == nmbr%10 and math.floor((nmbr%10000)/1000) == math.floor((nmbr%100)/10):
return True
elif nmbr < 1000000:
if math.floor(nmbr/100000) == nmbr%10 and math.floor((nmbr%100000)/10000) == math.floor((nmbr%100)/10) and math.floor((nmbr%10000)/1000) == math.floor((nmbr%1000)/100):
return True
lrgst = 0
#only checks numbers between 900 and 1000 since these are the biggest
for x in range(900, 1000):
for y in range(900, 1000):
if ispalindrome(x*y):
lrgst = x*y
print (str(lrgst))