Skip to content

Instantly share code, notes, and snippets.

@mikhail
Created April 17, 2018 18:00
Show Gist options
  • Select an option

  • Save mikhail/2e6fb1024771002309245648df4b348f to your computer and use it in GitHub Desktop.

Select an option

Save mikhail/2e6fb1024771002309245648df4b348f to your computer and use it in GitHub Desktop.
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