anonymous
  • anonymous
Hi I have a question about ps1 I believe I have a good code to test for prime # , how do I write a place to put results and limit results to 1000 ?
Computer Science
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
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.
chestercat
  • chestercat
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
anonymous
  • anonymous
Can you be a little bit more specific? what language are you using and what exactly do you want?
anonymous
  • anonymous
with Python I a, trying to find the 1000th prime , my code will produce primes within a range of numbers I specify , I want to be able to only printr the 1000th result .
anonymous
  • anonymous
I think you cannot jump to the 1000th number straightly, what you can do is, create a counter, and each time you find a prime number instead of printing it, increase that counter by 1, and check if that counter is = 1000 then only print the number.

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

anonymous
  • anonymous
ok that is what I am looking to do , where , and how do I add a counter ?
anonymous
  • anonymous
we cant say that without looking at the code. but the basic idea is that u want an outer loop that iterates everytime u find a prime and goes up to 1000th times
anonymous
  • anonymous
counter = 0 number =1 while(true) { if( number is prime) {counter++} if(counter=1000) { print number break the loop } number++ } here s simple pseudo-code you can create a boolean function for checking if the number is prime.
anonymous
  • anonymous
Hey you know there is a seperate study group for MIT course 6.00 Introduction to Python http://openstudy.com/groups/mit%206.0%20intro%20computer%20science%20(ocw)

Looking for something else?

Not the answer you are looking for? Search for more explanations.