For example, to return the 10,000th prime number I could write:
require \'prime\' Prime.first(10000).last #=> 104729
But creating a huge
Based on sawa's solution, here's a more succinct alternative:
Prime.find.with_index(1) { |_, i| i == 10000 } #=> 104729
or
Prime.find.with_index { |_, i| i == 9999 } #=> 104723