Solve this (each letter represent a different digit):
LISP *
FUN =
---------
NEWLISP
There are three solution.
p.s. obviously you have to use newlisp :-)
((("e" 9) ("f" 7) ("i" 6) ("l" 2) ("n" 1) ("p" 0) ("s" 4) ("u" 5) ("w" 8))
(("e" 8) ("f" 2) ("i" 3) ("l" 7) ("n" 1) ("p" 0) ("s" 6) ("u" 5) ("w" 4))
(("e" 9) ("f" 2) ("i" 8) ("l" 7) ("n" 1) ("p" 0) ("s" 4) ("u" 5) ("w" 6)))
.. and you should dazzle me with the code as well :)
I had a hard time avoiding brute-force, which I thought too boring, but then it started to take too much time for me so I gave up.
Ralph.
Hi Ralph, i have two functions to solve puzzle like this: one uses brute-force and the other uses "amb" :-))
//https://github.com/cameyo42/newLISP-Note/blob/master/15-note-libere-7.lsp#L9296
Thanks for posting the puzzle and your solution, cameyo!
I found the same 3 you found. I wish I could post them here but alas I'm getting the Internal Server Error page; so I'll just post a link to the code. The solution printout is in a comment at the bottom.
Like Ralph, I could not think of anything besides brute-force, but I added a little wrinkle that reduced the number of iterations by 6 times, so that it would run faster and, for that reason, wouldn't be "too boring." :)
https://git.sr.ht/~rick/newlisp-cryptarithmetic-puzzle/tree/master/item/lisp%2Afun%3Dnewlisp.lsp