I'm not sure this is the only Euler language that has ever existed, but it's the
one available now. "Poorly documented" isn't exactly the right word for this. Most
of the stuff in the documentation either doesn't work, or works significantly differently
from the way it's documented. For example, every piece of documentation that exists
for this language says that NOT EQUALS is ~=. It isn't. ~= is *something* because
the compiler accepts it and the interpreter executes it. It just isn't NOT
EQUALS. NOT EQUALS is !=. I wouldn't know this, except I forgot I wasn't typing
C++, and accidentally typed != instead of ~= in one place. The typo was the
only thing that worked.

If stuff like this weren't enough, familiar things are used in peculiar *undocumented*
ways. For example, semicolon is *neither* a statement separator nor a statement terminator
even though the documentation clearly shows it as a statement terminator. The semicolon is
used at the end of assignment statements to suppress the printing of the new variable values.

Thus the statement:

Candidates[1] = 0

means "change the first element of the array 'Candidates' to zero and then print the
entire 1000 element array," while the statement

Candidates[1] = 0;

means "change the first element of 'Candidates' without printing anything."

You may notice that I've printed each of the primes without the usual tag " is prime." If you can figure out how to add this, you're a better man than me.

This program compiles and runs under the freeware Euler compiler available here: http://mathsrv.ku-eichstaett.de/MGF/homes/grothmann/euler

function SieveE ##//////////////////////////////////////////////////////// ## Name: Peter M. Maurer ## Program: Sieve of Eratosthenes ## Due: Never ## Language: Euler ##/////////////////////////////////////////////////////// ## define the sieve data structure Candidates = 1:1000; for i=1 to 1000 ## everything is potentially prime until proven otherwise Candidates[i] = 1; end ## 1 is not prime, so flag it off Candidates[1] = 0; ## start the sieve with the integer 1 i = 1; repeat if i>=1000 break endif ## advance to the next un-crossed out number. ## this number must be a prime repeat if i>=1000 break endif if Candidates[i] != 0 break endif i = i + 1; end ## insure against running off the end of the data structure if i<1000 ## cross out all multiples of the prime, starting with 2*p. j = 2; k = i * j; repeat if k >= 1000 break endif Candidates[k] = 0; j = j + 1; k = i * j; end i = i + 1; endif end ## all uncrossed-out numbers are prime (and only those numbers) ## print all primes "Prime List" for i=1 to 999 if Candidates[i] != 0 i endif end return -1 endfunction