returns the least odd prime number which is greater than n.
# File lib/prime.rb, line 418
def next_to(n)
n = (n-1).div(2)*2+3 # the next odd number of given n
i,j = n.divmod(32)
loop do
extend_table until @table.length > i
if !@table[i].zero?
(j...32).step(2) do |k|
return 32*i+k if !@table[i][k.div(2)].zero?
end
end
i += 1; j = 1
end
end