summaryrefslogtreecommitdiff
path: root/miralib/ex/primes.m
blob: 2a7c5dfa1be691180062f9582323ff6123090948 (plain)
1
2
3
4
5
6
7
||The infinite list of all prime numbers, by the sieve of Eratosthenes.
||To see the list, just say `primes', or if you prefer
||	lay(map show primes)
||will print them one per line.  Hit control-C (interrupt) to stop.

primes = sieve[2..]
sieve (p:x) = p:sieve[n|n<-x;n mod p~=0]