I forget who asked about day-of-week, but a little experimentation shows that for the base date used by ACM#199 you need (j+1)%7. This means, I think, that their day 0 is a Monday. The result is 0 for Sunday through 6 for Saturday.