Most years have 52 weeks, some have 53, according to ISO8601.



Task

Write a function which determines if a given year is long (53 weeks) or not, and demonstrate it.




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
 
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
            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
