Friday, March 28, 2014

Checking if a number is prime in Ruby

Go to irb :

 > require 'prime'
 => true
 > Prime.prime?(2)
 => true
 > Prime.prime?(3)
 => true
 > Prime.prime?(10)
 => false