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.

90 INTEGER FUNCTIONS<br />

it comes out in closed <strong>for</strong>m so that we can easily check the answer. Our goal<br />

now will be to generalize the sum in (3.26) by finding an expression <strong>for</strong> Is this a harder sur’n<br />

of floors, or a sum<br />

of harder floors?<br />

integer m > 0, integer n.<br />

Finding a closed <strong>for</strong>m <strong>for</strong> this sum is tougher than what we’ve done so far<br />

(except perhaps <strong>for</strong> the discrepancy problem we just looked at). But it’s Be <strong>for</strong>ewarned: This<br />

instructive, so we’ll hack away at it <strong>for</strong> the rest of this chapter.<br />

As usual, especially with tough problems, we start by looking at small<br />

is the beginning of<br />

a pattern, in that<br />

the last part of the<br />

cases. The special case n = 1 is (3.26), with x replaced by x/m:<br />

chapter consists<br />

= LXJ .<br />

of ihe solution of<br />

some long, difficult<br />

problem, with little<br />

more motivation<br />

to get more data by generalizing<br />

than curiosity.<br />

-Students<br />

And as in Chapter 1, we find it useful<br />

downwards to the case n = 0:<br />

Our problem has two parameters, m and n; let’s look at some small cases<br />

<strong>for</strong> m. When m = 1 there’s just a single term in the sum and its value is 1x1.<br />

When m = 2 the sum is 1x/2] + [(x + n)/2J. We can remove the interaction<br />

between x and n by removing n from inside the floor function, but to do that<br />

we must consider even and odd n separately. If n is even, n/2 is an integer,<br />

so we can remove it from the floor:<br />

If n is odd, (n - 1)/2 is an integer so we get<br />

The last step follows from (3.26) with m = 2.<br />

These <strong>for</strong>mulas <strong>for</strong> even and odd n slightly resemble those <strong>for</strong> n = 0 and 1,<br />

but no clear pattern has emerged yet; so we had better continue exploring<br />

some more small cases. For m = 3 the sum is<br />

and we consider three cases <strong>for</strong> n: Either it’s a multiple of 3, or it’s 1 more<br />

than a multiple, or it’s 2 more. That is, n mod 3 = 0, 1, or 2. If n mod 3 = 0<br />

Touch& But c’mon,<br />

gang, do you always<br />

need to be to/d<br />

about applications<br />

be<strong>for</strong>e you can get<br />

interested in something?<br />

This sum<br />

arises, <strong>for</strong> example,<br />

in the study of<br />

random number<br />

generation and<br />

testing. But mathematicians<br />

looked<br />

at it long be<strong>for</strong>e<br />

<strong>computer</strong>s came<br />

along, because they<br />

found it natural to<br />

ask if there’s a way<br />

to sum arithmetic<br />

progressions that<br />

have been “floored.”<br />

-Your instructor

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

Saved successfully!

Ooh no, something went wrong!