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 ?
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!
Can you be a little bit more specific?
what language are you using and what exactly do you want?
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 .
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.
Not the answer you are looking for? Search for more explanations.
ok that is what I am looking to do , where , and how do I add a counter ?
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
counter = 0
if( number is prime)
break the loop
here s simple pseudo-code
you can create a boolean function for checking if the number is prime.