From: Steven Lumos Date: 2006-03-03T03:06:56+09:00 Subject: Re: Your Favorite One Liner Jeffrey Schwab writes: > William James wrote: >> Farrel Lifson wrote: >> >>>Whoops here it is.... >>> >>>farrel@nicodemus ~ $ cat primes.rb >>>puts [1]<<(2..ARGV[0].to_i).inject([]){|p,c|p.detect{|n|c%n==0}?p:p<>>farrel@nicodemus ~ $ ruby primes.rb 30 >>>1 >>>2 >>>3 >>>5 >>>7 >>>11 >>>13 >>>17 >>>19 >>>23 >>>29 >> 1 isn't a prime number. > > mv primes.rb non_composite_natural_numbers.rb Or just remove "[1]<<". The above actually builds an array like: [1, [2, 3, 5,...]] which probably isn't what you want anyway. Steve