Skip to content

Instantly share code, notes, and snippets.

@papachristoumarios
Last active October 15, 2015 13:28
Show Gist options
  • Save papachristoumarios/d1f32175b76539cf79e1 to your computer and use it in GitHub Desktop.
Save papachristoumarios/d1f32175b76539cf79e1 to your computer and use it in GitHub Desktop.
f = lambda m, *a: sum([10**i*(a[i] - m*a[-i-1]) for i in range(len(a))])
sp = lambda x: [int(y) for y in str(x)]
dom = lambda k: xrange(10**k, 5*10**(k))
X = dom(5)
for m in xrange(2,10):
for x in X:
if f(m, *sp(x)) == 0: print x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment