0
How to print a prime number pattern in Python
2 3 5 7 11 13 17 19 23 29
2 Answers
+ 3
thetechguy, you are not giving an accurate description of the Sieve of Eratosthenes. For a true description see this:
https://www.sololearn.com/learn/969/?ref=app
+ 1
To do this you can use the Sieve of Eratosthenes. Basically, you can check if a number is prime by checking its divisibility with all the primes less than that number.
Example:
79
Divisble by 2? No
Divisble by 3? No
...
Divisible by 73? No
Therefore 79 is prime.
For how to code it, you could either use recursive functions or nested for and if statements.