Change picture:

Choose file:

nsieve-bits


routine  nsieve(  bits  :  bitarray,  m=0  )
{
     bits[]  =  1;
     count  =  0;
     for(  i  =  2  :  m  ){
          if(  bits[i]){
               count  ++;
               for(  k  =  i+i  :  i  :  m  )  bits[k]  =  0;
          }
     }
     return  count;
}

routine  main(  n  =  2  )
{
     m  =  10000  *  (1<);
     bits  :  bitarray  =  1L  <<  (m+1);
     stdio.printf("Primes up to %8d %8d\n",  m,  nsieve(bits,  m));

     m  =  10000  *  (1<<(n-1));
     stdio.printf("Primes up to %8d %8d\n",  m,  nsieve(bits,  m));

     m  =  10000  *  (1<<(n-2));
     stdio.printf("Primes up to %8d %8d\n",  m,  nsieve(bits,  m));
}


view count 1159 times
created at 2009-02-20, 16:30 GMT

123 4
56 78910 11
121314151617 18
192021222324 25
26272829

fu: ... I forgot to say something about the plan for the whole new year in my previous reply. Well, besides w ... (Jan.19,01:40)

fu: ... Happy new dragon year (which will start from this sunday)! Actually, it was a busy month (I wish th ... (Jan.18,22:46)

ybabel: What's the plan for the new year ? Hello 'vry budy :- ) happy new year (when is the new year for you Fu ?) I saw you come back and comm ... (Jan.18,18:59)

This site is powered by Dao
Copyright (C) 2009,2010, daovm.net.
Webmaster: admin@daovm.net