Skip to content

Instantly share code, notes, and snippets.

@nagat01
Last active November 12, 2015 16:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nagat01/04f58b0b615b8e80f6f9 to your computer and use it in GitHub Desktop.
Save nagat01/04f58b0b615b8e80f6f9 to your computer and use it in GitHub Desktop.
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