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

Baba raoulbia at gmail.com
Mon Aug 16 14:04:27 EDT 2010


Hi Chas, Roald,

These are all complicated formula that i believe are not expected at
this level. If you look at the source (see my first submission) you
will see that this exercise is only the second in a series called
"Introduction to Programming". Therefore i am convinced that there is
a much simpler solution.

Now, i believe that the number of consecutive passes required to make
this work is equal to the smallest number of pack sizes. So if we have
packs of (9,12,21) the number of passes needed would be 9 and the
theorem would read

"If it is possible to buy n,n+1,n+2,...n+8 nuggets it is possible to
buy any number of nuggets >= 9 given that they come in packs of
9,12,21"

However i turn in circles because i don't seem to get any results for
some random pack combinations like (9,12,21) or (10,20,30).

The must always be a solution i'm thinking, be it the smallest pack -
1

Thoughts?

tnx
Raoul



More information about the Python-list mailing list