09.12.2012 Views

Concrete mathematics : a foundation for computer science

Concrete mathematics : a foundation for computer science

Concrete mathematics : a foundation for computer science

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

4.4 FACTORIAL FACTORS 113<br />

contributions of those ten numbers; this calculation corresponds to summing<br />

the columns of the following array:<br />

11 23456789101powersof2<br />

divisible by 2 x x x x x 5 = [10/2J<br />

divisible by 4 X X 2 = [10/4]<br />

divisible by 8 X 1 = [10/S]<br />

powersof 010201030 1 ( 8<br />

(The column sums <strong>for</strong>m what’s sometimes called the ruler function p(k),<br />

because of their similarity to ‘m ‘, the lengths of lines marking<br />

fractions of an inch.) The sum of these ten sums is 8; hence 2* divides lo!<br />

but 29 doesn’t.<br />

There’s also another way: We can sum the contributions of the rows.<br />

The first row marks the numbers that contribute a power of 2 (and thus are<br />

divisible by 2); there are [10/2J = 5 of them. The second row marks those<br />

that contribute an additional power of 2; there are L10/4J = 2 of them. And<br />

the third row marks those that contribute yet another; there are [10/S] = 1 of<br />

them. These account <strong>for</strong> all contributions, so we have ~2 (1 O!) = 5 + 2 + 1 = 8.<br />

For general n this method gives<br />

ez(n!) =<br />

This sum is actually finite, since the summand is zero when 2k > n. There<strong>for</strong>e<br />

it has only [lgn] nonzero terms, and it’s computationally quite easy. For<br />

instance, when n = 100 we have<br />

q(lOO!) = 50+25+12+6+3+1 = 97.<br />

Each term is just the floor of half the previous term. This is true <strong>for</strong> all n,<br />

because as a special case of (3.11) we have lr~/2~+‘J = Lln/2k] /2]. It’s especially<br />

easy to see what’s going on here when we write the numbers in binary:<br />

100 = (1100100)~ =lOO<br />

L100/2] = (110010)~ = 50<br />

L100/4] = (11001)2 = 2 5<br />

1100/8] = (1100)2 = 12<br />

[100/16J = (110)2 = 6<br />

1100/32] = (1l)z = 3<br />

[100/64J = (I)2 = 1<br />

We merely drop the least significant bit from one term to get the next.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!