|
|
last edited 1 year ago by test1 |
1 2 3 4 5 6 7 8 9 | ||
Editor: alfredo
Time: 2008/04/25 01:43:40 GMT-7 |
||
Note: Fix formatting |
From section 1.2 of Aldor Users Guide
# include "axiom.as"
import from Boolean, Integer, NonNegativeInteger;
sieve(n: Integer): Integer == { isprime: OneDimensionalArray Boolean := new(n::NonNegativeInteger, true);
np:Integer := 0; for p in 2..n | isprime p repeat { np := np + 1; for i in (p+p)..n by p repeat isprime i := false; } np }
Compiling FriCAS source code from file /var/zope2/var/LatexWiki/8473420842059482192-25px001.as using AXIOM-XL compiler and options -O -Fasy -Fao -Flsp -laxiom -Mno-ALDOR_W_WillObsolete -DAxiom -Y $AXIOM/algebra -I $AXIOM/algebra Use the system command )set compiler args to change these options. Compiling Lisp source code from file ./8473420842059482192-25px001.lsp Issuing )library command for 8473420842059482192-25px001 Reading /var/zope2/var/LatexWiki/8473420842059482192-25px001.asy
)lisp (si::allocate-contiguous-pages 1500 t)
>> System error: SB-INT:SIMPLE-READER-PACKAGE-ERROR at 31 (line 1, column 31) on #<SB- IMPL::STRING-INPUT-STREAM {100559D951}>: package "SI" not found
To run this program on your own computer you need linux and Axiom+Aldor from AxiomBinaries?.
$ vi sieve.as
$ AXIOMsys
(1) -> )compile sieve.as
for i in 1..6 repeat ( _ n := 10^i; _ outputList ["There are ", sieve n, " primes <= ", n] _ )