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<<c}
farrel@nicodemus ~ $ ruby primes.rb 30
1
2
3
5
7
11
13
17
19
23
29

On 3/1/06, Farrel Lifson <farrel.lifson / gmail.com> wrote:
> I did this while messing around at work one afternoon. Pretty sure it
> could be whittled down and made more efficient.
>
>
>
> On 3/1/06, Daniel Nugent <nugend / gmail.com> wrote:
> > Give out your favorite one liner, what it does, and when you use it.
> >
> > For me:
> >
> > puts ARGV[rand(ARGV.size)]
> >
> > It randomly prints one of the command line options passed to it.  I
> > typically use it to make a decision when I have no preference (or have
> > equal distaste) for my available options.
> >
> > For instance
> >
> > ruby -e "puts ARGV[rand(ARGVsize)]" "shoot self in head" "use Java"
> >
> > --
> > -Dan Nugent
> >
> >
>