So you’d think that, and it is approximately true. But the calendar repeats every 400 years (there are 97 leap years in 400, and 497 is a multiple of 7). And 400 isn’t a multiple of 7, so you can’t have it work out exactly.
To check, see this 5-line brute-force calculation in JavaScript: https://news.ycombinator.com/item?id=42024474