// Script function: Print all prime numbers less than 1000.

// Unless named starting with GlobalSino, EM, My, Self, the function commands are defined 
//by Gatan DM, please see at link: http://www.globalsino.com/EM/page2597.html

number EMi, EMj;
for(EMi=2; EMi<1000; EMi++) 
{
for(EMj=2; EMj <= (EMi/EMj); EMj++)
if(!(EMi%EMj)) break; // if factor found, not prime
if(EMj > (EMi/EMj))
result ("The EMi" + "\t" + EMi + "\t" + "is a prime number\n")
}




/*
This program determines if the number contained in EMi is prime by successively
dividing it by the values between 2 and the result of EMi/EMj. (It can stop at the value
of EMi/EMj because a number that is larger than EMi/EMj cannot be a factor of EMi.) If any
division is even, the number is not prime. However, if the loop completes, the
number is, indeed, prime.
*/