Now I'm doing work in the field of MIT, and for the second task, I feel that it left me in the cold. http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00-introduction-to-computer-science-and-programming-fall-2008/assignments/pset1a.pdf
The specificity of this is to write something that can calculate the 1000th number. We only know about the print, ==, =, 1 =, if, else, elif, while,%, -, +, *, / commands that I think. We also do not know about importing libraries.
My idea of ββhow this will work is to take an odd number and try to divide it by 3,4,5,6,7,8,9, and if% n! = 0, then add the number to the NumberofPrimes variable, starting with 11 as the basis of the tests, and assigning it a base value of 4 in the NumberofPrimes database, although I do not know if this is even correct, because I do not know how to display the 1000th number.
I close?
The last incarnation is this:
##calculate the 1000th prime number potprime = 3 numberofprime = 1 cycle = if potprime%3 = 0: break if potpimre%4 = 0: break if potprime%5 = 0: break if potprime%6 = 0: break if potprime%7 = 0: break if potprime%8 = 0: break if potprime%9 = 0: break numberofprime + 1 potprime + 1 if potprime%2 == 0: potprime = potprime + 1 if potprime != 0: cycle
Where exactly am I mistaken? Walk me through this step by step. I really want to find out, although I feel like they just catch a cold here.
At this point, it would be more useful for me to see how you can do the right one, and not do it. I work for 3 hours and did not go anywhere. If anyone has a solution, I would be more than happy to look at it and try to learn from it.