Learn / Library / Brainteasers
Calendar of a distant planet
On the planet Kest the week has days, numbered to . A year has months of , , and days in that order. A year divisible by but not by is long: its last month has days instead of . Day of month of year is weekday , and the weekday number goes up by (back to after ) with every day, continuing across month and year boundaries. In years to , how many months begin on weekday ?
Checking an answer needs JavaScript. The hint and the solution open without it.
Hint
Work out the weekdays of the month starts in a year as offsets from the weekday of its first day, and see how the year start moves from year to year.
Solution
- In any year starting on weekday , the month starts are , , and , which are , , and modulo , so a year contributes months starting on weekday if is or , and none otherwise.
- An ordinary year has days, a multiple of , so the next year starts on the same weekday; a long year has days and shifts the start by .
- The long years up to are the multiples of other than , , , and , so the start weekday of year is the number of long years before , modulo .
- This puts the start on weekday in years to , to and to ( years), and on weekday in years to , to and to ( years).
- These years contribute months each, so the total is .
Answer: