So, I was trying to express the formula for determining the next year on which a given date (month/day) will fall on a given weekday.
The internet has plenty of sites that explain how to determine the weekday of an arbitrary date (at least up through the 39th century). So I was able to get a good start.
The mod 7 of an offset number which can be calculated using specific formulas for day, month, year, and century will provide the "day number" of that date. So, for desired day number of X where the Do = the Day offset for the day of the month and Mo = the month offset for the month of the year, and y = the year we want to find ( and where X, Do, and Mo are known) we can say that
X-(Do +Mo)%7 = ((((39 - (floor(y/100)))%4)*2) % 7 + ((y%4) + (y%4)/4) % 7)%7
So in theory, all I have to do is solve for y, take the minimum and I have the next year that a month/day will fall on a particular weekday. However I quickly realized that I don't have the first clue how to begin solving for y when there is a modulus operation in the expression.
So I'd love help solving for y (and a check on my logic in constructing the above), or as a minimum, help with how to deal with modulus in solving/simplifying/reducing/operating on an algebraic expression.