Here's another approach for your benchmarking:
OFFSETS = [0, 2, 6, 8, ...]
...
p = 11
while p <= sqrtN
return false if OFFSETS.any? {|off| n % (p + off) == 0}
p += mod
end
return true
Cheers
robert
--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/