In: Advanced Math
Find the biggest “*prime gap” (see definition) from the prime
numbers between 1 and 1,000,000.
*Prime gap = the difference between two consecutive primes.
The exercise can be completed manually or with a computer program.
Whichever seems easiest.
I have written a C++ program to find the largest prime gap between 1 and 1,000,000. The same program can be modified to find the prime gap between any numbers. Although as the number gets larger and larger, the running time of the program gets longer. The largest prime gap between 1 and 1,000,000 is 114 between prime numbers 492113 and 492227.
The output of the program is: