Can anyone see what is wrong? it worked before :s
i get the print statement 'not found' infinate loop but im sure the last time i tried i got this thing working, as you can see, im looking for 6 consecutive numbers that do not = 6a +9b +20c. to give the highest number in the equation, cheers
MIT 6.00 Intro Computer Science (OCW)
Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.
Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
First you have to much stuff under your for loop you cant increment your n and count inside of the for loop because it will increment for every value in for loop.
line 2 sets n=1
line 4 = if n>0
line 21 is the else clause for line 4 - you will never get to line 22
your code looks like it might find six successive numbers of nuggets that you cannot buy (if that set exists) but you never do anything with that sixth number.
well maybe not; your comparison at line 9 might not be working because you have your n = n+1 statement in the innermost for loop - it probably needs to be outside of all the for loops. put a print statement in there to see what it is doing with respect to a, b and c - then you can see if n is doing what you want it to... something like
print 'a:',a,'b:',b,'c:',c,'n:',n in between lines 8 and 9
are you sure that there are six consecutive numbers that you cannot buy? i bet the maximum number of consecutive numbers that you cannot buy is 5.
if you can find six consecutive numbers that you Can buy (x --> x+5) and the theorem is right - whats the highest number you cannot buy?