You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

22 regels
295 B

fun sieve(n) {
var isPrime= {};
var i= 0;
while (i < n) {
isPrime[i]= 1;
i= i+1;
}
i= 2;
while (i < n) {
if (isPrime[i]) {
print(i);
var j= i+i;
while (j < n) {
isPrime[j]= 0;
j= j + i;
}
}
i = i + 1;
}
}
sieve(100);