https://projecteuler.net/problem=4
A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
Find the largest palindrome made from the product of two 3-digit numbers.
In [37]:
# YOUR CODE HERE
# My friend James Haraguchi (a computer science major UCI) helped me with this counter.
#Since I skype with him frequently, he may be listed as help on many assignments.
var_1 = 99
var_2 = 100
lisp = []
# For this next portion, I used advice from user Pedro Soria on StockExchange, specifically about reversing integers.
def rev(numb):
return int(str(numb)[::-1])
while var_1 != 1000 and var_2 != 1000:
var_1 += 1
var = var_1*var_2
if var == rev(var):
lisp.append(var)
elif var_1 == 999:
var_2 += 1
var_1 = 100
print(max(lisp))
In [32]:
# This cell will be used for grading, leave it at the end of the notebook.