Five weekends: Difference between revisions
Content added Content deleted
(→{{header|Tcl}}: Shorten long line) |
|||
Line 267: | Line 267: | ||
puts dates[0, 5].map { |d| d.strftime("%b %Y") }.join("\n") |
puts dates[0, 5].map { |d| d.strftime("%b %Y") }.join("\n") |
||
puts "..." |
puts "..." |
||
puts dates[-5, 5].map { |d| d.strftime("%b %Y") }.join("\n") |
puts dates[-5, 5].map { |d| d.strftime("%b %Y") }.join("\n") |
||
years_with_5w = dates.map(&:year).uniq |
|||
years = (1900...2100).to_a - years_with_5w |
|||
puts "There are #{years.size} years without months with 5 weekends:" |
|||
puts years.join(", ")</lang> |
|||
'''Output''' |
'''Output''' |
||
Line 281: | Line 288: | ||
May 2099 |
May 2099 |
||
Jan 2100 |
Jan 2100 |
||
Oct 2100 |
Oct 2100 |
||
There are 29 years without months with 5 weekends: |
|||
1900, 1906, 1917, 1923, 1928, 1934, 1945, 1951, 1956, 1962, 1973, 1979, 1984, 1990, 2001, 2007, 2012, 2018, 2029, 2035, 2040, 2046, 2057, 2063, 2068, 2074, 2085, 2091, 2096</pre> |
|||
=={{header|Tcl}}== |
=={{header|Tcl}}== |