So while the best answer is to budget (along the line of the answers to this question) and use a second, preferably interest-bearing, account to even out the pain of monthly bills, I'm curious if anyone has come up with a programmatic way of determining two days at opposite ends of every month that fall within different paychecks on a given year's bi-weekly (26 pay period) schedule?
This boils down to a cash flow management problem and there are software solutions for this out there. I am unsure of cost or quality, but that is the gist of the problem you are trying to solve. The software probably makes use of some operational research math, which is pretty intensive and not well documented in order to maximize cash flow.
There are much simpler, short cut ways of doing this. One is to always have at least one paycheck in your checking. Another might be to have the largest series of bills that are due in a single 14 day period in the checking. There are a few others, but in my opinion they all run too close for comfort.
The reality is that people regularly suffer minor unexpected expenses. Some refer to these as emergencies, but that word gets used far to freely for things that should be expected. Rather than turning those emergencies into disasters (by borrowing to solve them) it is better to have cash on hand. Without that cash on hand it makes it hard for a person to move forward in their financial life.
Additionally there was an academic study that was published recently that showed that cash on hand had a high correlation to a person's financial happiness. This WSJ article might provide a link to the study I was thinking about.
Some may think that this does not answer the question. I think it does: You should not be cutting it that close. Have some cash on hand. At least 1000, perhaps more depending on your stage of life. You will be happier, and you will meet your goals quicker.