Five weekends: Difference between revisions

no edit summary
(Added PicoLisp)
No edit summary
Line 166:
2091
2096</pre>
 
=={{header|k}}==
<lang k>
cal_j:(_jd[19000101]+!(-/_jd 21010101 19000101)) / enumerate the calendar
is_we:(cal_j!7) _lin 4 5 6 / identify friday saturdays and sundays
m:__dj[cal_j]%100 / label the months
mi:&15=+/'is_we[=m] / group by month and sum the weekend days
`0:,"There are ",($#mi)," months with five weekends"
m5:(?m)[mi]
`0:$5#m5
`0:,"..."
`0:$-5#m5
y:1900+!201 / enumerate the years in the range
y5:?_ m5%100 / label the years of the months
yn5:y@&~y _lin y5 / find any years not in the 5 weekend month list
`0:,"There are ",($#yn5)," years without any five-weekend months"
`0:,1_,/",",/:$yn5</lang>
Output:
<pre>
There are 201 months with five weekends
190103
190208
190305
190401
190407
...
209703
209808
209905
210001
210010
There are 29 years without any five-weekend months
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|Perl 6}}==
Anonymous user