Output of file : SCHULMAN.LST contained in archive : DDJ-9003.ZIP
INSIDE WATCOM C 7.0/386
by Andrew Schulman

[LISTING ONE]

\$ PRIMES.SET
\$ ISETL program to find number of primes <= n, using set notation

size := 1000 ;
sqrt_size := fix(sqrt(size)) ;
composites := {i*j : i in {3,5..sqrt_size}, j in {i..size div i}} ;
primes := {2} + {3,5..size} - composites ;
print size ;
print #primes ;

[LISTING TWO]]

\$ PRIMES.TUP
\$ ISETL program to find number of primes <= n, using ordered tuples

\$ tuple difference operator
diff := func(t1, t2);
return [i : i in t1 | i notin t2 ] ;
end;

size := 1000 ;
sqrt_size := fix(sqrt(size)) ;
composites := [i*j : i in [3,5..sqrt_size], j in [i..size div i]] ;
primes :=  + [3,5..size] .diff composites ;
print size ;
print #primes ;

[LISTING THREE]

\$ FIB.TUP
\$ ISETL program to find Fibonacci numbers, using dynamic programming

\$ uses log(): only accurate up to 308 digits
digits := func(x);
if (x = 0) then return 1 ;
else return 1 + floor(log(abs(x))) ;
end;
end;

\$ use "dynamic programming" to assign to fib()
fib := func(x);
fib(x) := fib(x-1) + fib(x-2) ;
return fib(x) ;
end;

fib(0) := 1 ;
fib(1) := 1 ;

fibonacci := [fib(x) : x in [1 .. 1000 ] ] ;
print fibonacci(1000) ;
print digits(fibonacci(1000)) ;



### 3 Responses to “Category : Files from MagazinesArchive   : DDJ-9003.ZIPFilename : SCHULMAN.LST”

1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/