Skip to content

Instantly share code, notes, and snippets.

@juliocesar
Forked from atnan/prime.rb
Created November 19, 2009 00:39
class Integer
def prime?
!("1" * self).match(/^1?$|^(11+?)\1+$/).nil?
end
end
class DHHException < Exception; end
raise DHHException, 'Whoops!' if !1.prime?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment