the problem is to 'Write a program that computes and prints the 1000th prime number.' on python. This is highschool level and we only write really basic code, no advanced operations. The hint said to start by generating odd numbers. I only got this much so far, and I'm really stuck and need assistance, please! count=0 i=2 while count !=1000: if (i%2!=0) (that basically narrows it down to odd numbers) @jabez177 @jabez177

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.

Get our expert's

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions.

A community for students.

the problem is to 'Write a program that computes and prints the 1000th prime number.' on python. This is highschool level and we only write really basic code, no advanced operations. The hint said to start by generating odd numbers. I only got this much so far, and I'm really stuck and need assistance, please! count=0 i=2 while count !=1000: if (i%2!=0) (that basically narrows it down to odd numbers) @jabez177 @jabez177

Computer Science
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
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.

Get this expert

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this and thousands of other questions

There is a very useful piece of information when you find prime numbers by the sieve of Eratosthenes. 1. You only have to test divisibility of prime numbers. For example, after a number is tested not divisible by 2 then it would not be divisible by 4,6,8... 2. You only have to test divisibility of primes up to and including the square-root of the highest number you need to test. In this case, the maximum number is 1000, so you need only to test all primes up to sqrt(1000)=31, which means testing for divisibility of 2,3,5,7....31 only. If a number below 1000 is not divisible by ALL the listed primes, the number itself is prime. In your code, the loop is not working well. If you use a while loop, you need a starting value (2), the stopping value (>1000, not !=1000) and an increment (either 1 or 2). Make some adjustments and run your code. Then post us the code and tell us what you get out of your code, and where you think the error might be, if any.
First, take a deep breath. This isn't a huge assignment, and it's not a bad choice for this point in a high school class. The first thing that you need to do is figure out what you'll need to do this. mathmate has mentioned that you may want to keep the primes that you've found around for later checks, so you'll need data structure to read/write the primes to, you'll need code to check "primeness" of a number, and a counter to know when you've gotten to 1000. When in doubt, break the problem into smaller parts. Sooner or later, the parts will be small enough that the code to do the part will become apparent.
Yes, I've misread the question. If you need the 1000th prime, you need to store around 100 primes for divisibility checks. This can be done simply with arrays, if you have already done arrays. You would then test divisibility until the size of the square-root of the prospective prime. Let's say you are testing the number 5273 for primality, you can stop at sqrt(5273)=72.6. That means after testing for divisibility of 71, you don't need to test divisibility of 73. As your course goes on, you will be learning more tools that you'll need. So don't get overwhelmed. Almost everyone who has done programming has gone through this.

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

Not the answer you are looking for?

Search for more explanations.

Ask your own question