Code
Diff
  • def is_prime(n)
       n.prime?
    end
  • 11
    def is_prime(n)
    
    2
        return false if n < 2
    
    3
        for x in 2.. Math.sqrt(n).round
    
    4
            return false if n % x == 0
    
    5
        end
    
    6
        return true
    
    2+
       n.prime?
    
    77
    end