Skip to content

Instantly share code, notes, and snippets.

@movEAX
Created September 3, 2015 22:35
Show Gist options
  • Save movEAX/d47dae4ca517172f87c6 to your computer and use it in GitHub Desktop.
Save movEAX/d47dae4ca517172f87c6 to your computer and use it in GitHub Desktop.
SEND + MORE = MONEY (python3)
from itertools import permutations
for p in permutations(range(10)):
(s,e,n,d,m,o,r,y,*_) = p
send = (10*(10*(10*s+e)+n)+d)
more = (10*(10*(10*m+o)+r)+e)
money = (10*(10*(10*(m+o)+n)+e)+y)
if send + more == money:
print('send=%d', send)
print('more=%d', more)
print('money=%d', money)
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment