simple-exercises/ruby-exercises/easy-1.rb
# Write a method that returns the `n`th prime number. Recall that only
# numbers greater than 1 can be prime.
Write a method that returns the `n`th prime number. Recall that only
numbers greater than 1 can be prime.
Write a method that returns the ` n ` th prime number . Recall that only numbers greater than 1 can be prime .
def is_prime?(n)
  if n == 2
    return true
  end
  (2...n).each do |i|
    if n % i == 0
      return false
    end
  end
  true
end
def is_prime? ( n ) if n == 2 return true end ( 2 ... n ) . each do | i | if n % i == 0 return false end end true end
Write a method that returns the `n`th prime number.
Write a method that returns the ` n ` th prime number .
n
<not_specific>