Ad
  • Custom User Avatar

    Agreed. Codewars uses Ruby 2.1.6, and this issue is not fixed until 2.2

    The random tests fail because although -3 should return false, Ruby 2.1.6
    sees it as -3.abs.prime?, where "self" is just 3.

    I filed a suggestion on this kata... IDK how much the author can do about this.

  • Custom User Avatar

    Which version of Ruby do you have locally? My Ruby 2.0.0 return false for negative numbers.

  • Custom User Avatar

    This didn't work for me because many of the tests are random and Ruby's stdlib Prime will return true for negative numbers when the absolute value is prime, but the test is not expecting it.