Some assumptions, because we have to assume something:

1) The market goes up at a constant rate per day (~0.02%/day if the annual increase is ~7.5%)

2) You pay 15% tax on dividends

3) Short time frames so we can assume simple instead of compound interest

Say you have a share of stock (or fund, etc.) worth $P/share. It pays an X% dividend, after which you have $P*X% in cash and a share worth ($P - $P*X%). But, you now have to pay 15% tax on that $P*X%, leaving you with 0.85*$P*X% cash and $P - $P*X% in stock, or $P - 0.15*$P*X% total.

The value of X depends, by a factor of 4, on whether the dividends are distributed quarterly or annually. VTSAX distributes quarterly, and currently does ~0.5%/qtr.

Thus, on the day of distribution, you lose 0.15*$P*X%. By waiting N days to buy, you lose $P*0.02%*N. Equating those, if X = 0.5, then N = 3.75.

In other words, if you are within ~4 days of the distribution then wait and buy afterward. If you are more than 4 days away, buy now.

In real life, market fluctuations usually make the "constant 0.02%/day increase" a bad assumption. Problem is, nobody knows if the real number will be higher or lower.