+ 3

How Do you get a series of prime number in python?

Python

14th May 2019, 11:21 PM
TroyđŸŒč
TroyđŸŒč - avatar
4 Answers
+ 5
You use a counter/flag and check for remainders with each number less than that number and if the remainder is 0, you have a factor. So, that number isn't a prime number. Thus, for whichever number the flag remains off, or the counter 0, that numbers would be prime. John ChampionđŸ–€đŸ”„ Try it out yourself. If you need more help, feel free to ask. Guezi Louay I don't think you should give away the code right away. You should just let them off with some hints so that they could practice and learn. Getting the answer is never the solution, the process matters.
15th May 2019, 10:57 PM
Kainatic [Mostly Inactive Now]
Kainatic [Mostly Inactive Now] - avatar
+ 2
Kainatic ..Thank you so much Your reply was more like a normal person❀
15th May 2019, 10:59 PM
TroyđŸŒč
TroyđŸŒč - avatar
+ 1
here’s my way of finding a certain amount of primes, it’s not the shortest code, but i wanted to make it as efficiĂ«nt as i could so yeah.. i just try to devide a number by all the primes that are smaller than that number and if the outcome is never 0 it’s a prime and than i just test the next number... https://code.sololearn.com/cXP80RNTKJOs/?ref=app
13th Jun 2019, 8:52 PM
Max Poppe
Max Poppe - avatar