kevara = function(n) {
var marked = [false, false];
for (i = 0; i < n; i ++)
{marked.push(true);}
for (p = 2; p <n + 1; p ++)
{
for (j = p; j < Math.floor(n/p) + 1; j ++)
{
marked [p*j] = false;
}
}
var betedesomme = 0;
for (k = 0; k < marked.length; k++)
{
if (marked[k] === true)
{
betedesomme += k;
}
}
return betedesomme;
}
kevara(1000);
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.