#include <fstream>
#include <iostream>
#include <cstdlib>
#include <cmath>
using namespace std;
int SofE () // Sieve of Eratosthenes, with sum
{
int numlist [2000000] = {0}; // list of all numbers
int max = sqrt(2000000.0);
for (int i = 0; i < 11; i++) // make list from 2 -> 2,000,000
{
numlist[i] = i+2;
}
for(int i1=0; i1 < max; i1++) // search list for primes
{
if (numlist[i1] != 0) // skip entries set to 0
{
for (int i2 = i1+1; i2 < 2000000; i2++)
{
if (numlist[i1]%numlist[i2] == 0) // if i2 devides equally into i1, remove it from options for prime
{
numlist[i2] = 0; // this number is not a prime!
}
}
}
}
// now all elements in numlist that are not 0 are primes :)
cout << "now it works!\n";
return 0;
}
int main ()
{
//bruteforceprimes (2000000);
cout << "wtf? \n";
int aa = SofE ();
}