Data update
This commit is contained in:
parent
07c7092a52
commit
61b93a2cd1
313 changed files with 6160 additions and 346 deletions
12
Task/Long-year/Lua/long-year.lua
Normal file
12
Task/Long-year/Lua/long-year.lua
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
function isLongYear (y)
|
||||
local function p (y)
|
||||
local f = math.floor
|
||||
return (y + f(y/4) - f(y/100) + f(y/400)) % 7
|
||||
end
|
||||
return p(y) == 4 or p(y - 1) == 3
|
||||
end
|
||||
|
||||
print("Long years in the 21st century:")
|
||||
for year = 2001, 2100 do
|
||||
if isLongYear(year) then io.write(year .. " ") end
|
||||
end
|
||||
|
|
@ -25,8 +25,8 @@ end = z
|
|||
|
||||
comment
|
||||
The simplest of several possible tests is that
|
||||
any calendar year starting or ending on a
|
||||
Thursday is "long", i.e., has 53 ISO weeks
|
||||
any ISO year starting or ending on a
|
||||
Thursday is "long", i.e., spans 53 weeks
|
||||
end
|
||||
function islongyear(yr = integer) = integer
|
||||
var thursday, result = integer
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue