Diditwithbuckets: NumberTheory: 3gal.&5gal. DieHard - - PowerPoint PPT Presentation

did it with buckets number theory 3 gal 5 gal die hard 3
SMART_READER_LITE
LIVE PREVIEW

Diditwithbuckets: NumberTheory: 3gal.&5gal. DieHard - - PowerPoint PPT Presentation

GeneralizedDieHard MathematicsforComputerScience MIT 6.042J/18.062J Diditwithbuckets: NumberTheory: 3gal.&5gal. DieHard 3gal.&9gal. Uniquefactorization Nowagal.&bgal.? AlbertRMeyer March5,2012


slide-1
SLIDE 1

Mathematics for Computer Science

MIT 6.042J/18.062J

Number Theory: Die Hard Unique factorization

Generalized Die Hard

Did it with buckets: 3 gal. & 5 gal. 3 gal. & 9 gal. Now a gal. & b gal.?

Albert R Meyer March 5, 2012

lec 5M.1

Albert R Meyer March 5, 2012

lec 5M.2

Generalized Die Hard Generalized Die Hard

Under Die Hard rules, Under Die Hard rules, gal.’s in each bucket are gal.’s in each bucket are linear combinations multiples of gcd(a,b)

  • f a and b
  • f a and b

Albert R Meyer March 5, 2012

lec 5M.3

Albert R Meyer March 5, 2012

lec 5M.4

1

slide-2
SLIDE 2

Generalized Die Hard Generalized Die Hard

Claim: Can get any multiple of gcd(a, b) into a bucket

(if there’s room for it).

Claim: Can get any linear combination of a, b into a bucket (if there’s room for it). Namely, say 0 ≤ sa +tb < b. Get sa +tb into the b gal. bucket as follows:

Albert R Meyer March 5, 2012

lec 5M.5

Albert R Meyer March 5, 2012

lec 5M.6

Generalized Die Hard

assume s > 0. do s times: fill bucket a, pour into b — if b fills, empty it. total fills = sa 0 ≤ amount left < b # b emptyings must be -t

Generalized Die Hard

In fact, no need to count: fill bucket a, pour into b — if b fills, empty it — until desired gal.’s in b !

Albert R Meyer March 5, 2012

lec 5M.7

Albert R Meyer March 5, 2012

lec 5M.8

2

slide-3
SLIDE 3

MIT OpenCourseWare http://ocw.mit.edu

6.042J / 18.062J Mathematics for Computer Science

Spring 2015 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.