RosettaCodeData/Task/Long-year/Phix/long-year.phix
2026-02-01 16:33:20 -08:00

26 lines
719 B
Text

with javascript_semantics
function week_number(integer y,m,d)
integer doy = day_of_year(y,m,d),
dow = day_of_week(y,m,d),
week = floor((doy-dow+10)/7)
return week
end function
--/* -- or: (same results)
constant Thursday = 4
function long_year(integer y)
return day_of_week(y,1,1)=Thursday
or day_of_week(y,12,31)=Thursday
end function
--*/
for c=20 to 22 do
sequence long_years = {}
integer century = (c-1)*100
for year=century to century+99 do
if week_number(year,12,28)=53 then
-- if long_year(year) then
long_years &= year
end if
end for
printf(1,"Long years in the %d%s century:%v\n", {c,ord(c),long_years})
end for