source/euler41.rb
# Made on the theory that they'd be faster to generate than to check
Made on the theory that they'd be faster to generate than to check
Made on the theory that they ' d be faster to generate than to check
def prime?
    return false if self == 1 
    return true if self == 2
    return false if self % 2 == 0
    i = 3
    until i * i > self
      return false if self % i == 0
      i += 2
    end
    return true
  end
def prime? return false if self == 1 return true if self == 2 return false if self % 2 == 0 i = 3 until i * i > self return false if self % i == 0 i += 2 end return true end
Made on the theory that they'd be faster to generate than to check
Made on the theory that they ' d be faster to generate than to check
# 1 isn't prime