Data update
This commit is contained in:
parent
81fd053722
commit
52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions
|
|
@ -13,7 +13,7 @@ bool leap(uint16_t year) {
|
|||
}
|
||||
|
||||
const char *weekday(Date date) {
|
||||
static const uint8_t leapdoom[] = {4,1,7,2,4,6,4,1,5,3,7,5};
|
||||
static const uint8_t leapdoom[] = {4,1,7,4,2,6,4,1,5,3,7,5};
|
||||
static const uint8_t normdoom[] = {3,7,7,4,2,6,4,1,5,3,7,5};
|
||||
static const char *days[] = {
|
||||
"Sunday", "Monday", "Tuesday", "Wednesday",
|
||||
|
|
|
|||
13
Task/Doomsday-rule/Mathematica/doomsday-rule.math
Normal file
13
Task/Doomsday-rule/Mathematica/doomsday-rule.math
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
doomsday[year_Integer?Positive] := Mod[2 + 5 Mod[year, 4] + 4 Mod[year, 100] + 6 Mod[year, 400], 7];
|
||||
|
||||
firstDoomsday[month_Integer /; 1 <= month <= 2, year_Integer?Positive /; LeapYearQ[{year}]] := {4, 1}[[month]];
|
||||
firstDoomsday[month_Integer /; 1 <= month <= 2, year_Integer?Positive] := {3, 7}[[month]];
|
||||
firstDoomsday[month_Integer /; 3 <= month <= 12, year_Integer?Positive] := {7, 4, 2, 6, 4, 1, 5, 3, 7, 5}[[month - 2]];
|
||||
|
||||
weekday[{year_Integer?Positive, month_Integer?Positive /; 1 <= month <= 12, day_Integer?Positive /; 1 <= day <= 31}] := Mod[doomsday[year] + 7 + day - firstDoomsday[month, year], 7];
|
||||
|
||||
weekdayName[weekday_Integer /; 0 <= weekday <= 6] := {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}[[weekday + 1]];
|
||||
|
||||
dates = {{1800, 1, 6}, {1875, 3, 29}, {1915, 12, 7}, {1970, 12, 23}, {2043, 5, 14}, {2077, 2, 12}, {2101, 4, 2}};
|
||||
|
||||
weekdayName /@ weekday /@ dates
|
||||
26
Task/Doomsday-rule/PascalABC.NET/doomsday-rule.pas
Normal file
26
Task/Doomsday-rule/PascalABC.NET/doomsday-rule.pas
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
const
|
||||
days: array of string = ('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
|
||||
dooms: array of array of integer = ((3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5),
|
||||
(4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5));
|
||||
|
||||
function isleap(year: integer) := (year mod 4 = 0) and ((year mod 100 <> 0) or (year mod 400 = 0));
|
||||
|
||||
function weekday(year, month, day: integer): string;
|
||||
begin
|
||||
var c := year div 100;
|
||||
var r := year mod 100;
|
||||
var s := r div 12;
|
||||
var t := r mod 12;
|
||||
var c_anchor := (5 * (c mod 4) + 2) mod 7;
|
||||
var doomsday := (s + t + (t div 4) + c_anchor) mod 7;
|
||||
var anchorday := dooms[if isleap(year) then 1 else 0][month - 1];
|
||||
var weekday := (doomsday + day - anchorday + 7) mod 7;
|
||||
result := days[weekday];
|
||||
end;
|
||||
|
||||
begin
|
||||
var dates := |(1800, 1, 6), (1875, 3, 29), (1915, 12, 7), (1970, 12, 23),
|
||||
(2043, 5, 14), (2077, 2, 12), (2101, 4, 2)|;
|
||||
foreach var d in dates do
|
||||
writeln(d[0], '-', d[1]:2, '-', d[2]:2, ' -> ', weekday(d[0], d[1], d[2]));
|
||||
end.
|
||||
7
Task/Doomsday-rule/Uiua/doomsday-rule.uiua
Normal file
7
Task/Doomsday-rule/Uiua/doomsday-rule.uiua
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
Ds ← [3 7 7 4 2 6 4 1 5 3 7 5]
|
||||
Ly ← ↧↥⊃(=0◿400|≠0◿100|=0◿4)
|
||||
D ← ◿7+⊃(Ly|+2++⊃(×5◿4|×4◿100|×6◿400))
|
||||
Wd ← ["Sun" "Mon" "Tue" "Wed" "Thu" "Fri" "Sat" "Sun"]
|
||||
DoW ← ⊡:Wd◿7+D⊙(-⊡-1:Ds)°[⊙⊙∘]
|
||||
[[1800 1 6][1875 3 29][1915 12 7][1970 12 23][2043 5 14][2077 2 12][2101 4 2]]
|
||||
≡(&p$"_\t_"/$"_-_"°⋕⇌⟜DoW)
|
||||
Loading…
Add table
Add a link
Reference in a new issue