looping through possible combinations of McNuggets packs of 6, 9 and 20

Roald de Vries downaold at gmail.com
Mon Aug 16 18:43:48 CEST 2010


On Aug 16, 2010, at 5:04 PM, Ian Kelly wrote:
> On Mon, Aug 16, 2010 at 4:23 AM, Roald de Vries <downaold at gmail.com>  
> wrote:
>>> I suspect that there exists a largest unpurchasable quantity iff at
>>> least two of the pack quantities are relatively prime, but I have  
>>> made
>>> no attempt to prove this.
>>
>> That for sure is not correct; packs of 2, 4 and 7 do have a largest
>> unpurchasable quantity.
>
> 2 and 7 are relatively prime, so this example fits my hypothesis.

I now notice I misread your post (as 'iff the least two pack  
quantities are relatively prime')

>> I'm pretty sure that if there's no common divisor for all three (or  
>> more)
>> packages (except one), there is a largest unpurchasable quantity.  
>> That is: ∀
>> i>1: ¬(i|a) ∨ ¬(i|b) ∨ ¬(i|c), where ¬(x|y) means "x is no  
>> divider of y"
>
> No.  If you take the (2,4,7) example and add another pack size of 14,
> it does not cause quantities that were previously purchasable to
> become unpurchasable.

Then what is the common divisor of 2, 4, 7 and 14? Not 2 because ¬(2| 
7), not anything higher than 2 because that's no divisor of 2.

Cheers, Roald


More information about the Python-list mailing list