From 7fee08bdd92213f9bd46d74073f30cce932562ff Mon Sep 17 00:00:00 2001 From: Peter Norvig Date: Wed, 6 Mar 2019 17:52:39 -0800 Subject: [PATCH] Update Cryptarithmetic.ipynb --- ipynb/Cryptarithmetic.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ipynb/Cryptarithmetic.ipynb b/ipynb/Cryptarithmetic.ipynb index 07770d8..7f3b14f 100644 --- a/ipynb/Cryptarithmetic.ipynb +++ b/ipynb/Cryptarithmetic.ipynb @@ -14,7 +14,7 @@ "> - Which distinct numerals (each different) can be substituted for letters to make a valid expression?\n", "> - How many solutions are there?\n", "\n", - "I [tackled]((https://www.udacity.com/wiki/cs212/unit-2#rethinking-eval)) this type of problem (known as a [cryptarithmetic](http://mathworld.wolfram.com/Cryptarithmetic.html) or [alphametic](http://mathworld.wolfram.com/Alphametic.html) problem) in my Udacity class [CS 212](https://www.udacity.com/wiki/cs212/unit-2#cryptarithmetic). \n", + "I [tackled](https://www.udacity.com/wiki/cs212/unit-2#rethinking-eval) this type of problem (known as a [cryptarithmetic](http://mathworld.wolfram.com/Cryptarithmetic.html) or [alphametic](http://mathworld.wolfram.com/Alphametic.html) problem) in my Udacity class [CS 212](https://www.udacity.com/wiki/cs212/unit-2#cryptarithmetic). \n", "\n", "My initial approach was simple: [when in doubt, use brute force](https://www.brainyquote.com/quotes/ken_thompson_185574). I try all permutations of digits replacing letters (that should be quick and easy—there can be at most 10 factorial or 3.6 million permutations), then for each one, I use Python's `eval` function to see if the resulting string is a valid expression. The basic idea is simple, but there are a few complications to worry about:\n", "\n",