primes
Mathematical Programming with Python
https://people.sc.fsu.edu/~jburkardt/classes/...
python_2025/primes/primes.html


primes: searching for all prime numbers over a given range. Improving the efficiency of the search. Testing a particular number for primality. Measuring the time required by a calculation. Fermat and Mersenne primes.

Lecture notes:

Blowup: Can we compute large integers?

The sieve of Eratosthenes:

Versions of the is_prime() function:

The Miller-Rabin primality test:

The Lucas-Lehmer primality test:

Counting primes:

Timing the prime calculation:

A timer:

Assignment #2 due on Friday, 31 January:


Last revised on 13 January 2025.