Here is

**Dartmouth** compatible BASIC interpreter for Windows. I''ve also attached a help guide for the BASIC.

**sieve.bas**`5 REM SIEVE OF ERATOSTHENES, BY ERATOSTHENES OF CYERENE, 276 BC - 194 BC`

10 PRINT "FIND PRIMES FROM 2 TO N (N <= 1000). ENTER N: "

20 INPUT N

30 IF N<2 THEN 10

40 IF N>1000 THEN 10

50 DIM A(1000)

60 LET S=SQR(N)

70 FOR I=2 TO S

80 IF A(I)=1 THEN 130

90 LET D=N/I

100 FOR J=I TO D

110 LET A(I*J)=1

120 NEXT J

130 NEXT I

140 FOR I=2 TO N

150 IF A(I)=1 THEN 170

160 PRINT I

170 NEXT I

180 END

C:\bas55v116>bas55 sieve.bas

FIND PRIMES FROM 2 TO N (N <= 1000). ENTER N:

? 10

2

3

5

7

C:\bas55v116>bas55

bas55 1.16

This is free software: you are free to change and redistribute it,

but there is NO WARRANTY. Type LICENSE to show the details.

Type HELP for a list of allowed commands.

Ready.

load "sieve.bas"

sieve.bas

Ready.

list

5 REM SIEVE OF ERATOSTHENES, BY ERATOSTHENES OF CYERENE, 276 BC - 194 BC

10 PRINT "FIND PRIMES FROM 2 TO N (N <= 1000). ENTER N: "

20 INPUT N

30 IF N<2 THEN 10

40 IF N>1000 THEN 10

50 DIM A(1000)

60 LET S=SQR(N)

70 FOR I=2 TO S

80 IF A(I)=1 THEN 130

90 LET D=N/I

100 FOR J=I TO D

110 LET A(I*J)=1

120 NEXT J

130 NEXT I

140 FOR I=2 TO N

150 IF A(I)=1 THEN 170

160 PRINT I

170 NEXT I

180 END

Ready.

Here is the Script BASIC version.

' SIEVE OF ERATOSTHENES, BY ERATOSTHENES OF CYERENE, 276 BC - 194 BC

10 PRINT "FIND PRIMES FROM 2 TO N (N <= 1000). ENTER N: "

20 LINE INPUT N

N = VAL(CHOMP(N))

30 IF N<2 THEN GOTO 10

40 IF N>1000 THEN GOTO 10

60 LET S=SQR(N)

70 FOR I=2 TO S

80 IF A[I]=1 THEN GOTO 130

90 LET D=N/I

100 FOR J=I TO D

110 LET A[I*J]=1

120 NEXT J

130 NEXT I

140 FOR I=2 TO N

150 IF A[I]=1 THEN GOTO 170

160 PRINT I,"\n"

170 NEXT I

180 END

C:\bas55v116>scriba sieve.sb

FIND PRIMES FROM 2 TO N (N <= 1000). ENTER N: 10

2

3

5

7

C:\bas55v116>

The

**FNx** inline functions are like a

**macro**. No FUNCTION / SUB in

**Minimal**. You do have GOSUB / RETURN for code blocks.

The other limitation in ECMA-55 is there is no

**sub-string** access functions. In Business BASIC a sub-string is represented as A$(start[,length]) without having to do a MID$() function.

No

**file** access other than LOAD / SAVE.