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 543 times
created at 2009-02-20, 16:30 GMT

123 4
56789 10 11
121314151617 18
192021222324 25
2627282930

fu: Fixed and updated There was a minor bug in storing returned value in the DaoVmProcess structure. Now it is fixed and up ... (Sep.07,23:43)

klabim: ... Ok, I found it. It can be so easy by reading the documentation :- ). I have overseen the keyword glob ... (Aug.21,18:09)

klabim: returning a string from function to c++ code! Hi, I run in some trouble while calling a dao function from the c++ code. The dao function should re ... (Sep.07,19:44)

klabim: sharing vars between scripts Hi, how can I share a variable between 2 scripts in an embedded environment? For example: script 1: ... (Aug.21,17:55)

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