Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
18
Task/Long-year/AppleScript/long-year-1.applescript
Normal file
18
Task/Long-year/AppleScript/long-year-1.applescript
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
on isLongYear(y)
|
||||
-- ISO8601 weeks begin on Mondays and belong to the year in which they have the most days.
|
||||
-- A year which begins on a Thursday, or which begins on a Wednesday and is a leap year,
|
||||
-- has majority stakes in the weeks it overlaps at *both* ends and so has 53 weeks instead of 52.
|
||||
-- Leap years divisible by 400 begin on Saturdays and so don't so need to be considered in the leap year check.
|
||||
|
||||
tell (current date) to set {Jan1, its day, its month, its year} to {it, 1, January, y}
|
||||
set startWeekday to Jan1's weekday
|
||||
|
||||
return ((startWeekday is Thursday) or ((startWeekday is Wednesday) and (y mod 4 is 0) and (y mod 100 > 0)))
|
||||
end isLongYear
|
||||
|
||||
set longYears to {}
|
||||
repeat with y from 2001 to 2100
|
||||
if (isLongYear(y)) then set end of longYears to y
|
||||
end repeat
|
||||
|
||||
return longYears
|
||||
10
Task/Long-year/AppleScript/long-year-2.applescript
Normal file
10
Task/Long-year/AppleScript/long-year-2.applescript
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
on isLongYear(y)
|
||||
return (y mod 400 is in {4, 9, 15, 20, 26, 32, 37, 43, 48, 54, 60, 65, 71, 76, 82, 88, 93, 99, 105, 111, 116, 122, 128, 133, 139, 144, 150, 156, 161, 167, 172, 178, 184, 189, 195, 201, 207, 212, 218, 224, 229, 235, 240, 246, 252, 257, 263, 268, 274, 280, 285, 291, 296, 303, 308, 314, 320, 325, 331, 336, 342, 348, 353, 359, 364, 370, 376, 381, 387, 392, 398})
|
||||
end isLongYear
|
||||
|
||||
set longYears to {}
|
||||
repeat with y from 2001 to 2100
|
||||
if (isLongYear(y)) then set end of longYears to y
|
||||
end repeat
|
||||
|
||||
return longYears
|
||||
Loading…
Add table
Add a link
Reference in a new issue