A certain chain store sells chocolate bars in packets of 17 and 9 only.
Clearly, you could not get 8 or 25 bars.
Find all quantities of bars that you cannot buy.
Generalize for m and n, mutually prime integers, m>n.
Let a1,a2,...am be the set of possible reminders of m.
Let's take ai. from the chinese reminder theory we have that there exists an x such that x=n*T, x = ai (m).
Now, for any x'>x such that x'=ai (m), we have x'=x+m*Z and
x'=n*T+m*Z. Thus x' is a quantity than can be bought.
However, as x is the minimum to fulfil the above requirement, we have that for any x''<x, x=ai(m) - x'' can not be bought.
Iterating over a1,a2,...am we aggregate these x'' and get the set of numbers that can not be bought.
Posted by Omri
on 2014-11-25 08:00:32