100 CALL CLEAR
$MLC F 110 10 3000
310 CALL LINK("ERATHO",C)
320 PRINT C;" prime numbers"::PRINT "from 2 to 32767."
330 END
$ERATHO
    DIMSET 2 32767 A        ; a is a set with elements from 2 to 32767
    SETFILL A               ; all elements in A
    LET B 2                 ; first element to find
    DO
        SETFINDNEXT A B     ; start looking for an element in A starting from B
    WHILE=                  ; if found, then B=element number, and B is PRIME
        LET C B             ; take the prime number
        DO
            ADD C B         ; computes 2*B, 3*B, 4*B, etc...
        WHILE>
            ELEMENT- A C    ; and remove this list from A
        LOOP
        INC B               ; see if there is another prime number after B
    LOOP
    SETCARD A C             ; computes cardinal of set A
    PUTPARAM 1 C            ; and return the cardinal
$$
$END
