Skip to content

Simple Python module for the time analysis of different possible approaches to primes list computation

Notifications You must be signed in to change notification settings

dario-marvin/PrimesList

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PrimesList

This python script analyzes and compares three different approaches to calculating the list of primes up to a given number:

  1. The simplest and possibly worst algorithm
  2. A polished and more efficient version of the previous algorithm, but still naive
  3. The sieve of Eratosthenes algorithm
  4. The sieve of Atkin, which has a theoretical better performance than the other algorithms, but actually depends on the implementation used. See here for an efficient code implementation

the list of primes up to 10000 is computed 5 times for each algorithm and the execution time is measured and printed

Some profiling of the execution time are then computed and plotted with the help of matplotlib

How to compile and execute the code

Save the source code file prime_numbers.py in a folder on your computer. Open a terminal and navigate to you folder with the command cd, then run the command

python3 prime_numbers.py

About

Simple Python module for the time analysis of different possible approaches to primes list computation

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages