# Primes

 FP  PFL   Examples   Syntax

Sieve of Eratosthenese by parallel (||) processes.

 ```let rec from = lambda n. fromchan!n -> from (n+1), fromchan = chan, sieve = lambda inch. inch?p -> output!p {must be prime} -> let rec filter = inch?x -> if (x/p)*p<>x then {not p|x} connect!x -> filter else filter, connect = chan in (filter || sieve connect) in from 2 || sieve fromchan {\fB Parallel Sieve of Eratosthenese. \fP} ``` example c1993.

A process is set up for each new prime -- to remove duplicates of that prime.

 let rec from = lambda n. fromchan!n -> from (n+1), fromchan = chan, sieve = lambda inch. inch?p -> output!p {must be prime} -> let rec filter = inch?x -> if (x/p)*p<>x then {not p|x} connect!x -> filter else filter, connect = chan in (filter || sieve connect) in from 2 || sieve fromchan {\fB Parallel Sieve of Eratosthenese. \fP}
window on the wide world:
 The Darwin Awards V: Next Evolution

 Linux  Ubuntu free op. sys. OpenOffice free office suite, ver 3.4+ The GIMP ~ free photoshop Firefox web browser FlashBlock like it says!

pfl...
 | || choice parallel sequence input act output act new channel

 © L. Allison   http://www.allisons.org/ll/   (or as otherwise indicated), Faculty of Information Technology (Clayton), Monash University, Australia 3800 (6/'05 was School of Computer Science and Software Engineering, Fac. Info. Tech., Monash University, was Department of Computer Science, Fac. Comp. & Info. Tech., '89 was Department of Computer Science, Fac. Sci., '68-'71 was Department of Information Science, Fac. Sci.) Created with "vi (Linux + Solaris)",  charset=iso-8859-1,  fetched Tuesday, 13-Oct-2015 19:56:46 EST.