You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Open commandline in the directory containing the executable
Execute the app with the following syntax: prime <filename> (<amount> [-log] [-binin] [-binout] [-allout]) || <-todec> || <-tobin>
Wait for the calculations to end
Parameters
-log - Saves the progress and speed at any time (basically the console output) to ".log.csv" so it can be futherly opened in Google Sheets or Ms Exel
-binin - Takes a compressed binary file as input ({filename}.prime)
-binout - Outputs binary compressed file instead of decimal ({filename}.prime)
-allout - Outputs both the compressed binary file and the decimal file
-tobin - Converts the decimal file to compressed binary
-todec - Converts the binary file to compressed decimal
How it works
std::vector<int> primes = {}; // Create a vector classfor (int i = 2; primes.size() < n; i++) { // Loop until vector's size is nint root = sqrt(i) + 1;
for (int ci : primes) { // Loop trough every know primeif (i % ci == 0)
gotobrk; // Number is not primeif (ci > root)
break; // Number is prime
}
primes.push_back(i);
brk:;
}
// Print primesfor (auto i : primes)
std::cout << i << std::endl;