Skip to content

Instantly share code, notes, and snippets.

@mikhail

mikhail/pal_power.py

Created Apr 17, 2018
Embed
What would you like to do?
Palindrome power
def is_pal(some_int):
reverse = list(str(some_int))
reverse.reverse()
reverse = int(''.join(reverse))
return some_int == reverse
def main():
start = 999
for offset in range(0, 999):
for check in range(0, offset + 1):
A = start - (offset - check)
B = start - check
if is_pal(A * B):
return A, B
print main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment