Long year: Difference between revisions

516 bytes added ,  10 months ago
Added Lua version
(→‎{{header|REXX}}: refurbished)
(Added Lua version)
Line 1,830:
2037
2043</pre>
 
=={{header|Lua}}==
<syntaxhighlight lang="lua">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</syntaxhighlight>
{{out}}
<pre>Long years in the 21st century:
2004 2009 2015 2020 2026 2032 2037 2043 2048 2054 2060 2065 2071 2076 2082 2088 2093 2099</pre>
 
=={{header|Mathematica}}/{{header|Wolfram Language}}==
<syntaxhighlight lang="mathematica">firstyear = 2000;
31

edits