function primes() { i=0, prime=true; while(p[i]*p[i]<=n) { if(n%p[i]==0) { prime = false; break; } i++; } if(prime) { document.primeform.primeelement.value=n; p[j++]=n++;--> setTimeout('primes()',500); } else { n++; primes(); } }