Following my previous "Brain Boggler" article (the "Black Box" that inverted three signals using only two NOT gates along with as many AND and OR gates as you cared to use), I was quickly buried under an avalanche of emails postulating some incredibly cunning solutions (if you're interested, these solutions are presented in "How To" articles 187202855 and 188101054 on the Programmable Logic DesignLine website).
Several of these messages presented new posers with which to delight us. Some of these were "old chestnuts," such as the perennial "Splitting a bill into three parts," conundrum, which appears in many forms; for example:
Three couples check into a hotel late one night. The manager charges each couple $10 to stay the night for which they all pay in cash. Sometime later, the manager realizes he's made a mistake and the couples were overcharged, so he gives the bellboy five $1 bills to distribute between the couples.
The bellboy realizes that it will be hard to split $5 three ways; so he decides to give each of the couples $1 and keep the remaining $2 for himself.
The conundrum is this; the couples each ended up paying $9 to stay at the hotel (their original $10 less the $1 returned by the bellboy). Now, $9 × 3 = $27, plus the $2 the bellboy has in his pocket = $29. But the couples originally paid $10 each, and $10 × 3 = $30, so what happened to the other dollar?
If you've not seen this one before, it can keep you amused for a while. In fact, one reader suggested a really interesting solution that I hadn't seen before (see the second page of this article for more details).
Sad to relate, however, most of us have run across the more common variations of problems like this in our time. Which makes it all the more exciting to be faced with what appears to be a truly original new teaser, such as the little scamp created by Integrated Circuit Design Consultant Keith Lofstrom ( www.kl-ic.com ).
Now, before we plunge into the fray, let's quickly remind ourselves as to how factorials work. For example, factorial 3, which is written as 3!, equates to 3 × 2 × 1 = 6. But what about the factorial of the factorial of 3, which we might write (3!)! = (6)! = 6 × 5 × 4 × 3 × 2 × 1 = 720. (Note that we wouldn't write the factorial of the factorial as 3!!, because "!!" is actually a different mathematic function in its own right – see the note at the bottom of this page for more details.) OK, keeping this in mind, let's proceed to Keith's conundrum, which he presents as follows:
John Jones creates a program to use his nifty new computer autodialer and he then instructs the program to call "911". Unfortunately, he hits the shift key and mistakenly enters 9!!, which is interpreted by the autodialer as (9 factorial)factorial.
The autodialer contains a powerful computer capable of very high precision integer math, and it proceeds to compute this long integer and then dial it. John has a regular telephone on the US public telephone network. John's autodialer dials 3 digits of a telephone number a second. He pays 3 cents per minute (rounded up to the nearest minute) for long distance charges.
Question one: Which US city does John end up calling with the first 11 usable digits (x-xxx-xxx-xxxx)?
Question two: Assuming both ends stay connected after the call is routed using the first usable digits, how long (in seconds) will the autodialer take to dial the full number and – ignoring taxes – how much will the call end up costing John?
As a hint, Keith notes that there are accurate ways to compute the phone number that can take many minutes on a fast desktop, or there is an approximation approach that takes only a fraction of a second to compute.
You might wish to take a little while to ponder this little rapscallion. When you have an answer (or if you simply decide to give up), visit the second page of this article to peruse and ponder the solution presented by Keith.
Note: The mathematic function !! is the product of every other number, so while 9! = 9 × 8 × 7 × 6 × 5 × 4 × 3 × 2 × 1 = 362880, 9!! = 9 × 7 × 5 × 3 × 1 = 945. Of course, (9!)! is quite a different kettle of fish as we shall see on Page 2.