Advertisement
cd62131

Friday the 13th

Dec 27th, 2018
505
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.38 KB | None | 0 0
  1. #!/usr/bin/python3
  2. from math import floor
  3.  
  4.  
  5. def zeller(year, month, day):
  6.     if month < 3:
  7.         year -= 1
  8.         month += 12
  9.     w = year + floor(year / 4) - floor(year / 100) + floor(
  10.         year / 400) + floor(2.6 * month + 1.6) + day
  11.     return w % 7
  12.  
  13.  
  14. print(
  15.     len([(y, m) for y in range(2000, 3000) for m in range(1, 13)
  16.          if zeller(y, m, 13) == 5]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement