Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 33 Online
OpenStudy (anonymous):

Problem set 2, problem 4

OpenStudy (anonymous):

I'm having trouble with problem four. For problem three, I exploited the fact that because the GCD of 6 and 9 is 3 and because 6 and 9 are three apart, any multiple of 3 > 6 is a buyable number of mcnuggets. And if the number is greater than 20, you can just subtract twenty and repeat that test. But for problem four, I'm trying to write a program that asks the user for the values of x, y, and z. Basically, it starts by asking you to set the values of the small, medium, and large sizes of mcnuggets, then proceeds to do the same test. At least, I'd like it to perform the same test. Can any advise me on a mathematical strategy/method for how solve a diophantine equation? I'm fine with doing an "exhaustive search" as the instructions say, basically looking at every possible combination of x, y, and z, but I can't figure our a way to represent that logically. Make sense?

OpenStudy (anonymous):

I used a series of nested loops to test various quantities of smalls, mediums, and larges

OpenStudy (anonymous):

The thing that I used to limit the loop was the total number of possible McNuggets--the problem says "find the largest number (less than 200) of McNuggets that cannot be bought in exact quantity," so if you get up to 200, you can stop. Then for me the relevant question became "If I can test total numbers of McNuggets up to a certain number, how can I test each possible combination of size-quantities that might total that number of McNuggets?"

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
Kimberly44: Enter your names down below AND whoever wins i will make you "Hot" :)
41 minutes ago 82 Replies 1 Medal
AxL1nna: Winner of 1 month sub isu2026
2 hours ago 22 Replies 3 Medals
Kimberly44: What skills do you have that will benefit the yearbook staff?
2 hours ago 1 Reply 1 Medal
AxL1nna: Doing 1 month sub give away
51 minutes ago 22 Replies 3 Medals
MissLatina: Help plss
5 hours ago 13 Replies 2 Medals
xXAikoXx: Brainpop >>>>>
2 hours ago 14 Replies 0 Medals
Tbone: CONGRATS LUGI ON PURPLE
2 hours ago 9 Replies 8 Medals
therizzler2009: math help please
8 hours ago 4 Replies 3 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!