Sha256: deb6514834291ab9f00777bf8c49d3f11212aea7d7f0ccf3b7dc389704973cb1

Contents?: true

Size: 729 Bytes

Versions: 10

Compression:

Stored size: 729 Bytes

Contents

// The Great Computer Language Shootout
// http://shootout.alioth.debian.org/
//
// modified by Isaac Gouy

function pad(number,width){
   var s = number.toString();
   var prefixWidth = width - s.length;
   if (prefixWidth>0){
      for (var i=1; i<=prefixWidth; i++) s = " " + s;
   }
   return s;
}

function nsieve(m, isPrime){
   var i, k, count;

   for (i=2; i<=m; i++) { isPrime[i] = true; }
   count = 0;

   for (i=2; i<=m; i++){
      if (isPrime[i]) {
         for (k=i+i; k<=m; k+=i) isPrime[k] = false;
         count++;
      }
   }
   return count;
}

function sieve() {
    for (var i = 1; i <= 3; i++ ) {
        var m = (1<<i)*10000;
        var flags = Array(m+1);
        nsieve(m, flags);
    }
}

sieve();

Version data entries

10 entries across 10 versions & 4 rubygems

Version Path
johnson19-2.0.0.pre3 vendor/tracemonkey/t/access-nsieve.js
pre-johnson-2.0.0 vendor/tracemonkey/t/access-nsieve.js
johnson-2.0.0.pre3 vendor/tracemonkey/t/access-nsieve.js
johnson-2.0.0.pre2 vendor/tracemonkey/t/access-nsieve.js
johnson-2.0.0.pre1 vendor/tracemonkey/t/access-nsieve.js
johnson-2.0.0.pre0 vendor/tracemonkey/t/access-nsieve.js
smparkes-johnson-1.1.2.6 vendor/tracemonkey/t/access-nsieve.js
smparkes-johnson-1.1.2.5 vendor/tracemonkey/t/access-nsieve.js
smparkes-johnson-1.1.2.4 vendor/tracemonkey/t/access-nsieve.js
smparkes-johnson-1.1.2.3 vendor/tracemonkey/t/access-nsieve.js