[PLUG-TALK] Autodialer numerical math puzzle
Keith Lofstrom
keithl at kl-ic.com
Wed Jun 14 17:52:11 UTC 2006
"Keith" == Keith Lofstrom <keithl at kl-ic.com> writes:
>
> Keith> Math puzzle:
>
> Keith> John Jones sets up a program to use his nifty new computer
> Keith> autodialer. He sets the program up to call "911".
> Keith> Unfortunately, he hits the shift key and enters 9!! instead.
> Keith> That is, (9 factorial)factorial.
>
> Keith> His autodialer contains a powerful computer capable of very
> Keith> high precision integer math, and it proceeds to compute this
> Keith> long integer, and dial it. John has a regular telephone on the
> Keith> US public telephone network. His autodialer dials 3 digits a
> Keith> second. He pays 3 cents per minute for long distance charges,
> Keith> rounded up to the nearest cent.
>
> Keith> Question one: What person or company does he end up calling,
> Keith> with the first usable digits? Name and address, please, as of
> Keith> June 2006.
>
> Keith> Question two: How long (in seconds) will the autodialer dial?
> Keith> Ignoring taxes, how much will the phone service cost John, if
> Keith> he (and the recipient) allows the whole sequence of digits to
> Keith> complete?
>
> Keith> Keith
>
> Keith> (yes, it IS a waste of time)
On Wed, Jun 14, 2006 at 02:30:17AM -0700, Russell Senior wrote:
...
> Answer 2: from the exponent on the resulting value, the number would
> have 1859934 digits. At three digits a second, that's 619978 seconds,
> which is 30,998.9 minutes (a little over a week: 7 days, 4 hours, 12
> minutes and 58 seconds). Let's say the phone company charges in full
> minutes, that's 30,999 minutes, times $0.03 = $929.97.
Bzzz. 619978 seconds is almost right. The first 11 digits are dial
time and not connected, so you gotta subtract that time that you are
not charged for! 7 days 4 hours 12 minutes and 58 seconds is the
same as 619978 seconds. However, divided by 60, that is 10,332.97
minutes, not 30,998.9 minutes. Times $0.03/min is $309.99 .
It's the simple calculations that can get you ...
> How'd I do? Do I win anything?
Call 1-609-714-4004 and find out ...
Sorry I kept you up most of the night with this (if your header times
are to be believed). :-)
BTW, one cheezy fast way to compute this (though not the whole number)
is to compute gammal(362881.0L)/log(10.0L) using libm, then expand the
fractional part. With long doubles, it gives the 11 digits and a
couple more digits of accuracy. Not as much fun or reliable as LISP!
Keith
--
Keith Lofstrom keithl at keithl.com Voice (503)-520-1993
KLIC --- Keith Lofstrom Integrated Circuits --- "Your Ideas in Silicon"
Design Contracting in Bipolar and CMOS - Analog, Digital, and Scan ICs
More information about the PLUG-talk
mailing list