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.

Lemmanow,<br />

dilemma later.<br />

3.5 FLOOR/CEILING SUMS 93<br />

When we experimented with small values of m, these three columns led respectively<br />

to a[x/aJ, bn, and c.<br />

In particular, we can see how b arises. The second column is an arithmetic<br />

progression, whose sum we know-it’s the average of the first and last terms,<br />

times the number of terms:<br />

(m- 1)n ;o+ ( m 1<br />

.m = (m-lb<br />

2<br />

So our guess that b = (m - 1)/2 has been verified.<br />

The first and third columns seem tougher; to determine a and c we must<br />

take a closer look at the sequence ofnumbers<br />

Omodm, nmodm, 2nmodm, . . . . (m-1)nmodm.<br />

Suppose, <strong>for</strong> example, that m = 12 and n = 5. If we think of the<br />

sequence as times on a clock, the numbers are 0 o’clock (we take 12 o’clock<br />

to be 0 o’clock), then 5 o’clock, 10 o’clock, 3 o’clock (= 15 o’clock), 8 o’clock,<br />

and so on. It turns out that we hit every hour exactly once.<br />

Now suppose m = 12 and n = 8. The numbers are 0 o’clock, 8 o’clock,<br />

4 o’clock (= 16 o’clock), but then 0, 8, and 4 repeat. Since both 8 and 12 are<br />

multiples of 4, and since the numbers start at 0 (also a multiple of 4), there’s<br />

no way to break out of this pattern-they must all be multiples of 4.<br />

In these two cases we have gcd( 12,5) = 1 and gcd( 12,8) = 4. The general<br />

rule, which we will prove next chapter, states that if d = gcd(m,n) then we<br />

get the numbers 0, d, 2d, . . . , m - d in some order, followed by d - 1 more<br />

copies of the same sequence. For example, with m = 12 and n = 8 the pattern<br />

0, 8, 4 occurs four times.<br />

The first column of our sum now makes complete sense. It contains<br />

d copies of the terms [x/m], 1(x + d)/mJ, . . . , 1(x + m - d)/m], in some<br />

order, so its sum is<br />

This last step is yet another application of (3.26). Our guess <strong>for</strong> a has been<br />

verified:<br />

a = d = gcd(m, n)

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

Saved successfully!

Ooh no, something went wrong!