Now this more like it!! 2008/4/5, Henry Rich <[EMAIL PROTECTED]>: > > Just for fun, I wrote a function header as I would have if > this were a verb in my library: > > NB. Monad. Calculate the list of primes less than y+2 > NB. y is a scalar > NB. Result is the list of primes < y+2, in ascending order > NB. We create the list 1..y+1; then we reverse the list to get > NB. y+1..1, and create the multiplication table of that with the > NB. list 2..y+2. The last item of the table is the list > NB. of candidate primes, and the other items of the table > NB. are multiples of those numbers. We then remove each > NB. set of multiples from the list of candidates. This is a > NB. sieve but we are sieving with all multiples, not just > NB. multiples of primes. > NB. > NB. The table goes from big numbers to small numbers so that > NB. the list of candidates is thinned out as quickly as > NB. possible. > > > Henry Rich >
-- Björn Helgason, Verkfræðingur Fugl&Fiskur ehf, Fornustekkum II, 781 Hornafirði Po Box 127,801 Selfoss , t-póst: [EMAIL PROTECTED] gsm: +3546985532 Landslags og skrúðgarðagerð, gröfuþjónusta http://groups.google.com/group/J-Programming Tæknikunnátta höndlar hið flókna, sköpunargáfa er meistari einfaldleikans góður kennari getur stigið á tær án þess að glansinn fari af skónum /|_ .-----------------------------------. ,' .\ / | Með léttri lund verður | ,--' _,' | Dagurinn í dag | / / | Enn betri en gærdagurinn | ( -. | `-----------------------------------' | ) | (\_ _/) (`-. '--.) (='.'=) `. )----' (")_(")
---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
