Ask your own question, for FREE!
Computer Science 20 Online
OpenStudy (anonymous):

need help with P1. here's what I've figured out so far but I don't know how to call for the 1000th number. help? def isprime(startnumber): startnumber*=1.0 for divisor in range(2,int(startnumber**0.5)+1): if startnumber/divisor==int(startnumber/divisor): return False return True for a in range(2,10000): if isprime(a): print a

OpenStudy (rsmith6559):

numPrimes = 0 a = 3 while numPrimes <= 1000 if isprime( a ) numPrimes += 1 if numPrimes == 1000 print "We have 1000!" a += 2

OpenStudy (anonymous):

I've just finished lecture 2 and looking at P1 and the tips, I think we need to isolate the odd numbers first and then figure out a method to test whether the odd number is a prime number. How do you test a number whether it is a prime?

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!