Skip to content

Instantly share code, notes, and snippets.

@Jaltman429
Created June 14, 2013 19:49
Show Gist options
  • Save Jaltman429/5784715 to your computer and use it in GitHub Desktop.
Save Jaltman429/5784715 to your computer and use it in GitHub Desktop.
prime.rb
def prime(number)
remainders = []
(2..number-1).each do |i|
remainders << (number % i).to_i
end
puts remainders.none? {|i| i == 0}
end
number = gets.chomp.to_i
prime number
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment