Created
May 31, 2009 05:53
-
-
Save nesquena/120783 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Reia script | |
module Sundays | |
def first_day_is_sunday(y, m) | |
calendar::day_of_the_week(y, m, 1) == 7 | |
end | |
def count_valid_months | |
[ 1 | y in 1901..2000, m in 1..12, first_day_is_sunday(y,m) ].size() | |
end | |
end | |
puts(Sundays.count_valid_months()) # => 171 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment