Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so dont bother with any of their useless mail servers here and just use oauth login instead. Thank the nice Russians for causing that. :)

Paste

Pasted as JavaScript by s.r ( 16 years ago )
var a = new Array(n);
a[0] = 2;
ii = 1;
for(i = 3; ii < n; i+=2) {
  tof = Math.sqrt(i);
  test = true;
  for(j = 0; a[j] <= tof; j++)
    if (i % a[j] == 0)
      test = false;
  if (test) {
    a[ii] = i;
    ii++;
  }    
}
alert&#40;a[a.length - 1]&#41;;

 

Revise this Paste

Parent: 22262
Your Name: Code Language: