Re: computing 20! all the way
Re: computing 20! all the way
- Subject: Re: computing 20! all the way
- From: Christopher Nebel <email@hidden>
- Date: Fri, 12 Nov 2004 20:42:44 -0800
On Nov 12, 2004, at 10:20 AM, Doug McNutt wrote:
At 09:14 -0800 11/12/04, Christopher Nebel wrote:
(In fact, the answer for 20! will be accurate, because it while it's
19 digits long, the last four are zero. 21! would not be, however.)
Now that's cute. In the binary representation it's divisibility by 2
that produces a trailing 0...
True -- I was sloppy in saying that trailing zeros in the decimal
result matter. They do, but not as much as divisibility by 2.
What are the prime factors of 20! ? Some of the digits will add more
than one binary zero at the right.
2 - 1
4 - 2
6 - 1
8 - 3
10 - 1
12 - 2
14 - 1
16 - 4
18 - 1
20 - 3
Summing, 19 zeros at the right end of the result can be shifted into
the floating point characteristic before precision is actually lost.
18 -- 20 is only 2^2 * 5. The complete factorization is
20! = 2^18 3^8 5^4 7^2 11 13 17 19
Since 20! is 62 binary digits long (how do I know that without knowing
the value in binary? I used logarithms), that means we've got 44
digits before the first trailing zero, well within the 54-bit mantissa.
--Chris Nebel
AppleScript Engineering
(Leaping off into complete trivia by mixing in another favorite of mine
-- palindromes: 1991 was a palindromic year that's the product of
palindromic primes: 11 and 181. The last one before that was 1661 (11
and 151); the next one will be 2112 (2^6, 3, and 11, though that's a
bit lame), and then again in 2222 (2, 11, and 101); the next one that
doesn't have any trivial (i.e., one-digit) palindromic factors isn't
until 3443. How many palindromic primes are there? Not counting the
single-digit ones, there are 16 less than 10^3, and 113 less than 10^6.
131, 10301, 1003001, and 10003001 are all prime, as are 151, 10501,
and 100050001, but not 1005001 (47 * 21383). Curiously, all
palindromic 4-, 6-, and 8-digit numbers are divisible by 11-- can
anyone explain why? Is this true for all even lengths?)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden