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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

74 INTEGER FUNCTIONS<br />

By the way, there’s a mnemonic <strong>for</strong> remembering which case uses floors<br />

and which uses ceilings: Half-open intervals that include the left endpoint<br />

but not the right (such as 0 < 8 < 1) are slightly more common than those<br />

that include the right endpoint but not the left; and floors are slightly more Just like we can recommon<br />

than ceilings. So by Murphy’s Law, the correct rule is the opposite member the date of<br />

of what we’d expect -ceilings <strong>for</strong> [OL . . p) and floors <strong>for</strong> (01. . 01.<br />

Columbus’s depart<br />

ure by singing, “In<br />

Similar analyses show that the closed interval [o(. . fi] contains exactly fourteen hundred<br />

Ll3J - [a] +1 integers and that the open interval (01.. @) contains [fi] - LX]- 1; ;o~u~~~-$;~;{~e<br />

but we place the additional restriction a # fl on the latter so that the <strong>for</strong>mula deep b,ue sea ,,<br />

won’t ever embarrass us by claiming that an empty interval (a. . a) contains<br />

a total of -1 integers. To summarize, we’ve deduced the following facts:<br />

interval integers contained restrictions<br />

[a.. 81 1B.l - Toil+1 a6 B,<br />

[a.. I31 Ml - bl a6 B, (3.12)<br />

(a.. Bl LPJ - 14 a< 6,<br />

(a..B) TPl - 14 -1 a< p.<br />

Now here’s a problem we can’t refuse. The <strong>Concrete</strong> Math Club has a<br />

casino (open only to purchasers of this book) in which there’s a roulette wheel<br />

with one thousand slots, numbered 1 to 1000. If the number n that comes up<br />

on a spin is divisible by the floor of its cube root, that is, if<br />

then it’s a winner and the house pays us $5; otherwise it’s a loser and we<br />

must pay $1. (The notation a\b, read “a divides b,” means that b is an exact<br />

multiple of a; Chapter 4 investigates this relation carefully.) Can we expect<br />

to make money if we play this game?<br />

We can compute the average winnings-that is, the amount we’ll win<br />

(or lose) per play-by first counting the number W of winners and the number<br />

L = 1000 - W of losers. If each number comes up once during 1000 plays,<br />

we win 5W dollars and lose L dollars, so the average winnings will be<br />

5w-L 5w-(looo-w) 6W- 1000<br />

~ =<br />

1000 ;ooo = 1000 .<br />

[A poll of the class<br />

at this point showed<br />

that 28 students<br />

thought it was a<br />

bad idea to play,<br />

13 wanted to gamble,<br />

and the rest<br />

were too confused<br />

to answer.)<br />

(So we hit them<br />

with the <strong>Concrete</strong><br />

If there are 167 or more winners, we have the advantage; otherwise the ad- Math aub.1<br />

vantage is with the house.<br />

How can we count the number of winners among 1 through 1 OOO? It’s<br />

not hard to spot a pattern. The numbers from 1 through 23 - 1 = 7 are all<br />

winners because [fi] = 1 <strong>for</strong> each. Among the numbers 23 = 8 through<br />

33 - 1 = 26, only the even numbers are winners. And among 33 = 27 through<br />

43 - 1 = 63, only those divisible by 3 are. And so on.

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

Saved successfully!

Ooh no, something went wrong!