Python Mockup - Prime Numbers
- Michael Borcherds
Primes numbers are positive whole numbers with exactly 2 distinct factors. For example 13 is prime because it has exactly 2 factors: 1 and 13. Drag the red dot below to explore the factors of different numbers. When just 2 circles are red, you have found a prime number!
Now have a look at the Python program below. Try running it. * There's a mistake in the output, can you see what? Can you fix the program? * Modify the program to print more prime numbers. * It's not very efficient at the moment. See if you can improve it (add some timing first to check). * Try re-writing it totally to use the Sieve of Eratosthenes