Mersenne primes are a subset of prime numbers that follow a particular pattern, where they can be expressed as "2^p - 1" form (with 'p' as prime number). Why this form? When 'p' is a prime number, "2^p" is an even number because it's a power of 2. Subtracting 1 from an even number results in an odd number.
The code besides the trial division method used to check if a number is prime, the code also utilizes the Lucas–Lehmer test (LLT) to determine if a given number is a prime exponent. How it works?
So if
then the original prime number pp is a prime exponent, suggesting that M_p could be a Mersenne prime.
In order to show how this works, we've made a simple C program that check if a given number is prime and if it's a prime exponent, which is a necessary condition for a Mersenne prime about first 1M numbers.
To build and run this project, you'll need:
- CMake
Follow these steps to build the project using CMake:
- Clone the repository to your local machine: git clone https://github.com/FrancescoPaoloL/MersennePrimeNumbers.git
- Navigate to the project directory: cd your-repository
- Create a build directory: mkdir build --> cd build
- Generate the build files using CMake: cmake ..
- Build the project using the appropriate build tool (e.g., make): make
After following these steps, you should find the compiled executable in the build directory. You can run the executable to execute the program.
This project is licensed under the MIT License - see the LICENSE.md file for details