On Jan 18, 2007, at 11:10 AM, William James wrote: > Ryan Davis wrote: >> I wrote mine a bit different: >> >> def prime(n) >> return false if n > 2 and n % 2 == 0 >> max = sqrt(n) >> 3.upto(max) do |i| >> return false if i % 2 != 0 and n % i == 0 >> end >> return true >> end >> >> optimize :prime > > You're saying that pure Ruby took less than 2 seconds? > I don't see how that is possible. On the faster of the two > computers at my disposal your version ran in 207 seconds. Yes, on my computer it ran in 2 seconds, but I didn't have the same driver as you did because I couldn't go into the bignum range. So I did the biggest you had an extra 20 times instead.