Last active
November 12, 2015 16:16
-
-
Save nagat01/04f58b0b615b8e80f6f9 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
open System | |
let occs = Array.zeroCreate 7 | |
for year in 1970 .. 2037 do | |
for month in 1..12 do | |
let day = DateTime(year, month, 13).DayOfWeek |> int | |
occs.[day] <- occs.[day] + 1 | |
let total = Seq.sum occs | |
for i, day in Seq.indexed "日月火水木金土" do | |
let ratio = float occs.[i] * 100.0 / float total | |
printfn "%c曜日 : %d (%f %%)" day occs.[i] ratio | |
// 日曜日 : 117 (14.338235 %) | |
// 月曜日 : 116 (14.215686 %) | |
// 火曜日 : 118 (14.460784 %) | |
// 水曜日 : 115 (14.093137 %) | |
// 木曜日 : 117 (14.338235 %) | |
// 金曜日 : 117 (14.338235 %) | |
// 土曜日 : 116 (14.215686 %) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment