Is this a correct implementation of eratosthenes's sieve?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
    vector <int> arr (1,2);



    bool isprime;




    for (int c=3;c<50000;c++)  // primes up to 5000
    {


        for (int m=0;m<arr.size();m++)    // checks against previous primes
        {
            isprime =true;

            if (c % arr[m] == 0)          // if current number modulus any previous prime is 0 then not a prime
            {
                isprime =false;
                break;
            }

        }

        if (isprime)                  // if prime add to other primes to be checked.
        {

            arr.push_back (c);
            cout << c<<endl;

        }


    }



If so could someone give me hints about how to make it faster?
That is not even close to a sieve.
Lol, I'll try again.
Topic archived. No new replies allowed.