Page 1 of 1
Cryptarithmetic
Posted: Sat Mar 19, 2022 7:22 pm
by cameyo
Solve this (each letter represent a different digit):
There are three solution.
p.s. obviously you have to use newlisp :-)
Re: Cryptarithmetic
Posted: Mon Mar 28, 2022 2:06 pm
by cameyo
Code: Select all
((("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)))
Re: Cryptarithmetic
Posted: Tue Mar 29, 2022 4:03 am
by ralph.ronnquist
.. 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.
Re: Cryptarithmetic
Posted: Tue Mar 29, 2022 9:45 am
by cameyo
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-Not ... .lsp#L9296
Re: Cryptarithmetic
Posted: Wed Mar 30, 2022 12:38 am
by rickyboy
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-cryptar ... ewlisp.lsp