JSFiddle - React, Tailwind, and code Playground

by nipheon

JavaScript

var beginn = new Date();

var bis = 1000000;

/* function primzahl(foo)

{
    for (bar = 2; bar < foo; bar++)
 { if ( foo % bar === 0)
 
 { return false;}
return true;}
}

for (foo = 3; foo <= bis; foo++)
{ 
  if (primzahl(foo)) { document.write(foo+"<br/>"); }
 }
*/
 
var bis = 100000;

for (foo = 3; foo <= bis; foo++)
{ var prim = true;

    for (bar = 2; bar < foo; bar++)
 { if ( foo % bar === 0)
 
 { prim = false; break;} }
  
  if (prim === true) { document.write(foo+"<br/>"); }
 }

/*
    
var zahl = 666;

for (bar = 2; bar < zahl; bar++)
 { if ( zahl % bar === 0) document.write(bar+"<br/>");
 };
    
*/
    
var ende = new Date();
    
document.write(ende-beginn);