diff options
Diffstat (limited to 'problem19.ijs')
-rw-r--r-- | problem19.ijs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/problem19.ijs b/problem19.ijs new file mode 100644 index 0000000..6b92cdf --- /dev/null +++ b/problem19.ijs @@ -0,0 +1,32 @@ +isleap =: monad define + divBy4 =. 0=4|y + divBy100 =. 0=100|y + divBy400 =. 0=400|y + divBy4*.divBy400+.-.divBy100 +) + +daysInMonth =: dyad define + feb =. (isleap x){28 29 + y{31,feb, 31 30 31 30 31 31 30 31 30 31 +) + +nextMonthStart =: monad define + ('year';'month';'day') =. y + days =. year daysInMonth month + day =. 7 | days + day + if. month = 11 do. + (year+1);0;day + else. + year;(month+1);day + end. +) + +start =: nextMonthStart^:12 (1900;0;0) + +generateMonths =: 13 : '(nextMonthStart^:y) start' + +months =: generateMonths i. 1199 + +startedOnSunday =: 6 = [: > 2 { ] + +result =: +/startedOnSunday"1 months
\ No newline at end of file |