Why now could be the best time to play Mega Millions

A bigger jackpot doesn't always mean a better time to play

With the Mega Millions jackpot boosted to $540 million for Friday's drawing, mathematical modeling predicts it is getting very, very close to the best time statistically to play.

A CNBC historical analysis of public lottery data reveals an interesting phenomenon first documented by computer scientist Jeremy Elson: A bigger jackpot doesn't necessarily mean a better time to play. In fact, it could mean the opposite.

First off, it's worth defining the measure that gamblers and statisticians look to in deciding whether a bet is worth the wager: expected value.

Essentially, the expected value of a bet is derived from the probability of winning a bet and the size of the payout. In this case, Mega Millions offers a one in nearly 259 million chance at $540 million.

In determining if a bet makes rational sense, gamblers look for bets that offer an expected value greater than the cost to play. For Mega Millions, the cost is constant at $1 per ticket, so the focus falls squarely on a ticket's expected value.

But a key variable is often left out of that calculation — the probability of winners splitting a jackpot, which is influenced directly by the number of tickets purchased. As an analysis of Mega Millions drawings since the rules were changed in 2013 shows, ticket sales tend to rise exponentially as advertised jackpots increase.

Intuitively, the more tickets in play, the higher the probability of seeing multiple winners and a split jackpot. That in turn mathematically lowers the expected value of an individual lottery ticket, explaining why a larger jackpot that stirs up intense news coverage might not always be the best proposition.

Running a regression on Mega Millions drawings reveals the sweet spot for maximizing the expected value of a $1 ticket appears to be around a jackpot of $547 million, or just $7 million more than Friday's advertised jackpot. At that level, the expected value of a ticket comes to 64 cents after accounting for taxes, net present value and the lesser prizes. To be fair, a small number of data points in the range above $600 million could limit the model's forecasting at higher jackpots.

But of course, no one plays the lottery for the expected value of a ticket. Doing so wouldn't make much sense seeing as the $1 cost of a Mega Millions ticket is designed to be more than the expected value (the house essentially always wins). But if that's the case, why were 107 million tickets purchased for the last drawing?

Economists, and our revealed preference, point to the idea that there must be a certain level of utility derived from the thrill of the game and the chance at walking away with a large jackpot. Behavioral economists, citing the foundational work from psychologists Daniel Kahneman and Amos Tversky, would also add that humans have a tendency to overestimate low-probability events, such as winning the lottery, making any perceived expected value of a lottery ticket much higher.

The point is there are many reasons why so many make an irrational gamble. However, if you're looking to rationally maximize the worth of your irrational $1 gamble, choosing to play around now could be an economical bet.

— CNBC's Alex Rosenberg contributed to this report