Skip to content

Instantly share code, notes, and snippets.

@yuan3y
Last active August 29, 2015 14:10
Show Gist options
  • Save yuan3y/fd0dc8a69d84df4cdfd4 to your computer and use it in GitHub Desktop.
Save yuan3y/fd0dc8a69d84df4cdfd4 to your computer and use it in GitHub Desktop.
abcd*e=dcba for ntu coe fb page
__author__ = 'yuan3y'
for i in range(1023, 4987):
for j in range(2, 10):
if i * j > 9999 or str(i).find(str(j)) > 0:
break
if str(i)[-1::-1] == str(i * j):
print(i, j, i * j)
@yuan3y
Copy link
Author

yuan3y commented Nov 28, 2014

using python list comprehension, the following code would do the same job:

print([(i,j) for i in range(1023,4987) for j in range(2,10) if (i*j<10000) and (str(j) not in str(i)) and (str(i)[3::-1] == str(i*j))])```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment