Now that MITx first test is over, I got feeling that this one task requested for generate and test solution is begging also for less efficient recursive solution as it is so simple. Here it is! Single liner aproved by the released grader! If you wander if you are able to buy exactly n nuggets by boxes of 6, 9 or 20 nuggets each, it tells the answer. It does not tell you how heavy your shopping bags would be and how many geeks you need to eat them ;) This recursive version can not deal with 1000000 nuggets (using modulo and nuggets2, you can find that also), but it can tell you that it is possible to get 10001 nuggets. The included iterative count telling version can tell you that it can be manged by 499 twenties, 1 niners and 2 sixes.
Edited 4 Years Ago by pyTony: modulo recursive version added