You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: primes.rb
    path of file: ./repos/langs-performance
    
    the code of the file until where you have to start completion: require 'time'

def get_primes7(n)
  return [] if n  < 2
  return [2] if n == 2

  # do only odd numbers starting at 3
  s = 3.upto(n + 1).select(&:odd?)

  mroot = n ** 0.5
  
    
def get_primes7(n)
  return [] if n  < 2
  return [2] if n == 2

  # do only odd numbers starting at 3
  s = 3.upto(n + 1).select(&:odd?)

  mroot = n ** 0.5
  half = s.length
  i = 0
  m = 3
  until m > mroot do
    if s[i]
      j = (m * m - 3) / 2
      s[j] = nil
      until j >= half do
        s[j] = nil
        j += m
      end
    end
    i += 1
    m = 2 * i + 3
  end
  [2] + s.compact
end