title: How do I generate the first n prime numbers?
body: <p>I am learning Ruby and doing some math stuff.  One of the things I want to do is generate prime numbers.</p>
  
  <p>I want to generate the first ten prime numbers and the first ten only.  I have no problem testing a number to see if it is a prime number or not, but was wondering what the best way is to do generate these numbers?</p>
  
  <p>I am using the following method to determine if the number is prime:</p>
  
  <pre><code>class Integer &lt; Numeric
    def is_prime?
      return false if self &lt;= 1
      2.upto(Math.sqrt(self).to_i) do |x|
        return false if self%x == 0
      end
      true
    end
  end
  </code></pre>