The Jewish calendar has a 19 year cycle, where Years 3, 6, 8, 11, 14, 17, and 19 (גוחאדז”ט) are leap years (מ), they have a second Adar. The other years are Pashut, simple years with only one Adar.
Obviously we can calculate the position of the current year in the cycle by doing mod 19.
5773 % 19 == 16 ; // This year is pashut, but next year is a leap year.
How can we write a single equation that we can use to test if a year is a leap year or not.
There is a solution on Wikipedia, but I’m more interested in the process than the final answer.