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

Hi all. I just solved (I think) PS2,Q3. I know my code is very inefficient, but it took a lot of work just to solve the thing. Any suggestions as to alternative solutions (especially those that are simpler than my own) would be great. Thanks. http://codepad.org/1c6lIZsn

OpenStudy (anonymous):

I will have some suggestions. But first I have a question. You have defined two functions: diophantine and mcnuggets. Can you describe each function? What is the input of the function? What is the output of the function? And how does the function compute the output from the input?

OpenStudy (anonymous):

I think your mcnuggets function determines whether a particular number is or is not a solution to the diophantine equation. Is my assumption correct?

OpenStudy (anonymous):

Yes, that is correct. The mcnuggets function determines whether a particular number is or is not a solution to the diophantine equation. It also then adds the number into its corresponding list (solvable vs. unsolvable number by the diophantine equation). The Diophantine function is an iterative function that increases the number of mcnuggets tested until the end test (six consecutive solvable number) is true. It then prints the last value added to the unsolvable list. I'm convinced that this can be accomplished in only one function, although I'm not sure exactly how. Here is an updated code, with comments describing the functions. http://codepad.org/YtID4zOz

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!
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!