06.03.2017 Views

Mathematics for Computer Science

e9ck2Ar

e9ck2Ar

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.

“mcs” — 2017/3/3 — 11:21 — page 333 — #341<br />

9.13. References 333<br />

(e) Let m be the smallest integer linear combination of a and b that is positive.<br />

Show that m D gcd.a; b/.<br />

Homework Problems<br />

Problem 9.12.<br />

Here is a game you can analyze with number theory and always beat me. We start<br />

with two distinct, positive integers written on a blackboard. Call them a and b.<br />

Now we take turns. (I’ll let you decide who goes first.) On each turn, the player<br />

must write a new positive integer on the board that is the difference of two numbers<br />

that are already there. If a player cannot play, then they lose.<br />

For example, suppose that 12 and 15 are on the board initially. Your first play<br />

must be 3, which is 15 12. Then I might play 9, which is 12 3. Then you might<br />

play 6, which is 15 9. Then I can’t play, so I lose.<br />

(a) Show that every number on the board at the end of the game is a multiple of<br />

gcd.a; b/.<br />

(b) Show that every positive multiple of gcd.a; b/ up to max.a; b/ is on the board<br />

at the end of the game.<br />

(c) Describe a strategy that lets you win this game every time.<br />

Problem 9.13.<br />

Define the Pulverizer State machine to have:<br />

states WWD N 6<br />

start state WWD .a; b; 0; 1; 1; 0/ (where a b > 0)<br />

transitions WWD .x; y; s; t; u; v/ !<br />

.y; rem.x; y/; u sq; v tq; s; t/ (<strong>for</strong> q D qcnt.x; y/; y > 0):<br />

(a) Show that the following properties are preserved invariants of the Pulverizer<br />

machine:<br />

gcd.x; y/ D gcd.a; b/;<br />

sa C tb D y; and<br />

ua C vb D x:<br />

(Inv1)<br />

(Inv2)<br />

(Inv3)<br />

(b) Conclude that the Pulverizer machine is partially correct.

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

Saved successfully!

Ooh no, something went wrong!