title: ruby function returns different boolean value in irb vs repl.it
body: <p>I have written the following function to check if a number is prime:</p>
  
  <pre><code>def is_prime?(number)
    arr = (2..number).to_a.select {|m| number % m == 0}
    arr.length == 1 ? true : false
  end
  </code></pre>
  
  <p>When passing 4 or 9 as the number in irb, it correctly returns false. However, in <a href="https://repl.it/Br7y/452" rel="nofollow">repl.it</a> these evaluate to true.</p>
  
  <p>Here is the test code I am running on repl.it:</p>
  
  <pre><code>puts("\nTests for #is_prime?")
  puts("===============================================")
  puts('is_prime?(2) == true: ' + (is_prime?(2) == true).to_s)
  puts('is_prime?(3) == true: ' + (is_prime?(3) == true).to_s)
  puts('is_prime?(4) == false: ' + (is_prime?(4) == false).to_s)
  puts('is_prime?(9) == false: ' + (is_prime?(9) == false).to_s)
  puts("===============================================")
  </code></pre>
  
  <p>And its output:</p>
  
  <pre><code>Tests for #is_prime?
  ===============================================
  is_prime?(2) == true: true
  is_prime?(3) == true: true
  is_prime?(4) == false: true
  is_prime?(9) == false: true
  ===============================================
  What could be causing this variation?
  </code></pre>