Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from datetime import date, timedelta
- DAYS_IN_YEAR = 365
- DAYS_IN_CYCLE = DAYS_IN_YEAR * 4 + 1
- LEAP_DAY = 59 # Feb 29th
- CYCLE_START = date(2024, 1, 1)
- def valid(interval, startDay):
- currentDay = startDay
- VloggedDay = [False] * DAYS_IN_YEAR
- VloggedLeapDay = False
- for _ in range(DAYS_IN_YEAR + 1):
- if currentDay < LEAP_DAY:
- VloggedDay[currentDay % DAYS_IN_YEAR] = True
- elif currentDay > LEAP_DAY:
- VloggedDay[(currentDay - 1) % DAYS_IN_YEAR] = True
- else:
- VloggedLeapDay = True
- currentDay += interval
- currentDay %= DAYS_IN_CYCLE
- return all(VloggedDay) and VloggedLeapDay
- for interval in range(2, 45 + 1):
- for startDay in range(DAYS_IN_CYCLE):
- if valid(interval, startDay):
- print(f"{interval:>2}", CYCLE_START + timedelta(days=startDay))
- # Output:
- #
- # 2 2024-02-29
- # 2 2026-03-01
- # 3 2024-02-29
- # 3 2025-03-01
- # 4 2024-02-29
- # 4 2024-03-01
- # 20 2024-02-29
- # 20 2024-03-01
- # 20 2024-03-02
- # 20 2024-03-03
- # 20 2024-03-04
- # 20 2024-03-05
- # 34 2025-03-01
- # 34 2025-03-02
- # 34 2025-03-03
- # 34 2025-03-04
- # 34 2025-03-05
- # 34 2025-03-06
- # 34 2025-03-07
- # 34 2025-03-08
Advertisement
Add Comment
Please, Sign In to add comment