Cryptarithmetic

Featuring the Dragonfly web framework
Locked
cameyo
Posts: 183
Joined: Sun Mar 27, 2011 3:07 pm
Location: Italy
Contact:

Cryptarithmetic

Post by cameyo »

Solve this (each letter represent a different digit):

Code: Select all

   LISP *
    FUN =
---------
NEWLISP
There are three solution.
p.s. obviously you have to use newlisp :-)

cameyo
Posts: 183
Joined: Sun Mar 27, 2011 3:07 pm
Location: Italy
Contact:

Re: Cryptarithmetic

Post 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)))

ralph.ronnquist
Posts: 228
Joined: Mon Jun 02, 2014 1:40 am
Location: Melbourne, Australia

Re: Cryptarithmetic

Post 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.

cameyo
Posts: 183
Joined: Sun Mar 27, 2011 3:07 pm
Location: Italy
Contact:

Re: Cryptarithmetic

Post 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

rickyboy
Posts: 607
Joined: Fri Apr 08, 2005 7:13 pm
Location: Front Royal, Virginia

Re: Cryptarithmetic

Post 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
(λx. x x) (λx. x x)

Locked