2 <!-- MOZ_INSERT_CONTENT_HOOK -->
3 <script src = runner.js
></script>
5 var onlyName
= 'N-Sieve Bits', onlyNum
= 2;
8 // The Great Computer Language Shootout
9 // http://shootout.alioth.debian.org
11 // Contributed by Ian Osgood
13 function pad(n
,width
) {
15 while (s
.length
< width
) s
= ' ' + s
;
19 function primes(isPrime
, n
) {
20 var i
, count
= 0, m
= 10000<<n
, size
= m
+31>>5;
22 for (i
=0; i
<size
; i
++) isPrime
[i
] = 0xffffffff;
25 if (isPrime
[i
>>5] & 1<<(i
&31)) {
26 for (var j
=i
+i
; j
<m
; j
+=i
)
27 isPrime
[j
>>5] &= ~(1<<(j
&31));
32 startTest("real-nsieve-bits");
34 for ( var i
= 1; i
<= 4; i
++ ) (function(i
){
35 test( "N-Sieve Bits", i
, function(){
36 var isPrime
= new Array((10000<<i
)+31>>5);
44 <body onload=
"thisTest()"></body></html>