This project is a multi-threaded prime number generator written in C++. It efficiently finds prime numbers and logs them to a file.
- A C++ compiler that supports C++11 or later.
- CMake (optional, for building the project).
- Clone the repository:
git clone https://github.com/Aydinhamedi/PrimeGen_CPP_Multithreaded.git
- Navigate to the project directory:
cd prime-PrimeGen_CPP_Multithreaded
- Compile the project:
- If you have CMake installed, you can build the project using:
cmake . make
- Alternatively, compile the
main.cpp
file directly with your C++ compiler.
- If you have CMake installed, you can build the project using:
- Run the compiled binary:
./PrimeGen_CPP_Multithreaded.exe
- The program will start generating prime numbers and logging them to
Prime_nums.txt
.
The program automatically adjusts the number of threads based on the hardware concurrency or a custom number for optimal performance. It displays the speed of prime number generation in primes per second.
Contributions are welcome! Please feel free to submit pull requests or open issues for any improvements or bug fixes.
This project is licensed under the MIT License - see the LICENSE file for details.