LoginSignup
1
0

More than 1 year has passed since last update.

Julia: 『アイの歌声を聴かせて』が21世紀だとしたら何年なのか、プログラミングで挙げてみる

Last updated at Posted at 2022-04-10

Julia でやってみた。2021 年以降なのかどうかわからなかったので 2001 年〜 2100 年まで探索。

using Dates
dr = Date(2001):Day(1):Date(2100, 12, 31);
result = filter(dr) do x
   dayofweek(x) == Mon && month(x) == 6 && day(x) == 9
end

15-element Vector{Date}:
2003-06-09
2008-06-09
2014-06-09
2025-06-09
2031-06-09
2036-06-09
2042-06-09
2053-06-09
2059-06-09
2064-06-09
2070-06-09
2081-06-09
2087-06-09
2092-06-09
2098-06-09

それぞれの日にちにおける月齢については,計算できたら付記するかもしれない。

追記:

以下に基づき計算。数日の誤差はあるそうだ。

moonage(y, m, d) = (11((y - 11) % 19) +
   [0, 2, 0, 2, 2, 4, 5, 6, 7, 8, 9, 10][m] + d) % 30

for t in result
   y, m, d = year(t), month(t), day(t)
   println("$t 月齢 $(moonage(y, m, d))")
end

2003-06-09 月齢 9
2008-06-09 月齢 5
2014-06-09 月齢 11
2025-06-09 月齢 13
2031-06-09 月齢 19
2036-06-09 月齢 14
2042-06-09 月齢 20
2053-06-09 月齢 22
2059-06-09 月齢 28
2064-06-09 月齢 24
2070-06-09 月齢 0
2081-06-09 月齢 1
2087-06-09 月齢 8
2092-06-09 月齢 3
2098-06-09 月齢 9

正確な月齢の計算は下記へ

1
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0