LoginSignup
1
0

More than 5 years have passed since last update.

20111213が今年最後の素数日であることの検証

Last updated at Posted at 2012-03-16
lastPrime2011.rb
def isPrime(n)
  2.upto(Math.sqrt(n).to_i) {|i|
    if n%i==0
      return false
    end
  }
  return true
end

20111213.upto(20111231) do |i|
  if isPrime(i)
    puts i
  end
end
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0