Prime numbers using wheel factorial
for loops

You are doing the same thing over and over again in many places in the code.

For example,

for (u64 k = start; (lcm*k) &lt; limit; k++){
    u64 K = lcm*k;
    if ((primes[k] &amp; (ONE &lt;&lt; 0)) &amp;&amp; (K+F30[0]) % num == 0)
        primes[k] &amp;= ~(ONE &lt;&lt; 0);
        ......
        if ((primes[k] &amp; (ONE &lt;&lt; 7)) &amp;&amp; (K+F30[7]) % num == 0)
            primes[k] &amp;= ~(ONE &lt;&lt; 7);
}


could become

for(u64 k = start; lcm*k &lt; limit; k++)
{
    u64 K = lcm*k;
    for(int i = 0; i &lt; 8; i++)
    {
        if ((primes[k] &amp; (ONE &lt;&lt; i)) &amp;&amp; (K+F30[i]) % num == 0)
            primes[k] &amp;= ~(ONE &lt;&lt; i);
    }
}


There are many other places you could do this as well. Also, the while loop near the bottom could be transformed into a for loop, as you are basically doing a for loop with while.
u64 vs int

Don't use a u64 when you don't need them; ints save on storage. You can replace the bottom two loops with regular ints.
Comments

Your code is somewhat confusing when you look at it on first glance. Maybe you should add some comments for the reader to see what is happening in your MarkNonPrimes function. Also, in the variable count (why declare it to 3-1 instead of 2?), and how you got that magic constant 0.26 in your vector declaration. The naming of F30 is pretty cryptic too.
Conventions

If you are going to use a convention then stick with it. Don't use ONE &lt;&lt; 0 then ONE&lt;&lt;0 later.
Global variables

See here. Pass the variables as a parameter instead of declaring them globally, because as the project grows in size, then it will become harder to not have an ambiguous match for your global names. However, the constant ONE is fine, because not many variables will have the name one, but you should rename it u8_ONE instead because you may be declaring a u16_ONE or something of the sort.


Here is the code with all the modifications (except comments and naming):

#include &lt;iostream&gt;
#include &lt;vector&gt;
#include &lt;algorithm&gt;
#include &lt;ctime&gt;

typedef uint64_t u64;
const uint8_t u8_ONE = 1;    
void markNonPrimes(const u64 start, const u64 num, const u64 lcm, const u64 limit, std::vector&lt;uint8_t&gt; &amp;primes, u64 F30[])
{
    for(u64 k = start; lcm*k &lt; limit; k++)
    {
        u64 K = lcm*k;
        for(int i = 0; i &lt; 8; i++)
        {
            if ((primes[k] &amp; (u8_ONE &lt;&lt; i)) &amp;&amp; (K + F30[i]) % num == 0)
                primes[k] &amp;= ~(u8_ONE &lt;&lt; i);
        }
    }
}

void getPrimesUpto(u64 limit)
{
   const u64 F30[] = {1,7,11,13,17,19,23,29};

   const u64 lcm = 30;
   std::vector&lt;uint8_t&gt; primes(limit*0.26 + 1,0xff);
   u64 n = 0;
   u64 count = 2;
   for(int i = 1; i &lt; 8; i++)
   {
       markNonPrimes(1, F30[i], lcm, limit, primes, F30);
   }
   for(int k = 1; lcm * k * lcm * k &lt; limit; k++)
   {
      const u64 K = lcm * k;
      for(int i = 0; i &lt; 8; i++)
          if(primes[k] &amp; (u8_ONE &lt;&lt; i))
              markNonPrimes(k+1, K+F30[i], lcm, limit, primes, F30);
   }

   for(int k=0; lcm*k &lt; limit; k++)
   {
      for(int i = 0; i &lt; 8; i++)
         if(primes[k] &amp; u8_ONE &lt;&lt; i &amp;&amp; lcm * k + F30[i] &lt; limit)  
         {
             count++;
             /*std::cout &lt;&lt; lcm*k+F30[i] &lt;&lt; " ";*/
         }
   }

   std::cout  &lt;&lt; "\n======\n"&lt;&lt; count &lt;&lt; "\n";
}

int main()
{
   clock_t start = clock();
   getPrimesUpto(100);
   std::cout &lt;&lt; "\nTime: "&lt;&lt; clock() - start &lt;&lt; std::endl;
}