**Update, Oct. 19 at 1 p.m.:** The jackpot is now projected to be an astonishing $1 billion, with a cash option of $565 million. This changes the math below a bit, but ultimately it just means the value of your ticket is even better.

**Original post: **Mega Millions will hold a drawing on Friday for what is predicted to be the second-largest lottery jackpot in U.S. history—$970 million. Such a dazzling total reels in those who otherwise would never play the lottery, and millions will cough up $2 for a ticket to chase the prize. But can you, a rational thinker, justify such a seemingly pointless purchase?

If $970 million really meant $970 million, the answer would definitely be yes. The odds of winning are incredibly low, of course, but with such a high prize value, you can calculate the worth of the ticket to be about $1.50 more than what you’ll pay. Mathematically speaking, that would be a no-brainer. But we don’t live in a simple, tax-free world, and once the federal government has taken its cut, the value of the ticket decreases to just above its price. But even if you factor in variabilities for tax brackets and state tax, the likelihood remains that the ticket’s reasonably worth your money.

Let’s take a look at the math. The odds of winning the Mega Millions jackpot is about 302,575,350 to 1. Those aren’t great odds, and they’ve been recently made worse by the company, which restructured its system to have fewer but grander payouts. If the people wanted drama, they’re getting it: Three of the six largest Mega Millions jackpots ever were paid out since the rules change last October.

From the odds and the potential payoff, you can figure out the value of your ticket. Using a calculation laid out by Jordan Ellenberg in Slate (in which you divide the $970 million by 302 million, the odds against you, and then do the same for each smaller prize that you could win even if you don’t match all six numbers), we can calculate that if you think of the winnings as the full jackpot amount, a ticket would be worth about $3.45. That would make a $2 ticket a pretty good deal.

It gets trickier when you think about other factors. There’s the 37 percent you’ll pay in federal taxes on the jackpot, the federal taxes you’d pay on smaller prizes (with some variability when factoring in potential deductions you might have as well as what tax bracket you start in), however much more you’d pay in state taxes, and the amount you lose if you choose to take the lump sum rather than annuity payments, which will typically chip off about 30 or 40 percent the initial amount, according to CNBC. In this instance, the cash option is expected to be $548 million, according to Mega Millions.

Assuming you choose the annuity payments (the lump sum could ultimately be a smarter move if you invest your money wisely) and taxes take 37 percent (we’ll ignore state taxes), you’ll get $611 million from the jackpot. With that calculation, the value of a ticket comes out at about $2.02—pretty much at the $2 value of a ticket. If you factor in the smaller prizes (and assume you’re in a middle tax bracket), your ticket is worth $2.20—a good deal.

State taxes are where the math gets really complicated. To know if taxes take you below that $2 value, you’ll have to read up on the tax guidelines that apply to you and the specific rules for the lottery in your state, if your state has them. If you live in a state with low or no personal income tax, you might want to spend that $2 on a ticket. And if you live in a state like California where taxes aren’t withheld from lottery winnings, there’s that too. But if you live somewhere with a state tax higher than 8 percent, you might want to reconsider.

And we can consider another possible (though unlikely) event that would significantly fracture the jackpot: a split pot. It is impossible to know if the jackpot will see even one winner, much less multiple, but given the incredibly low odds of winning the game, there have been very few split pots in the recently revamped Mega Millions. Regardless, the more people who play, the greater the chances of multiple winners. When you have a huge jackpot with a large number of people buying in, the probability of having those winnings to yourself decreases. And if you knew there would be a split pot, your ticket would *definitely* be worth less than $2. If you want to give yourself the best deal, you should avoid picking sets of numbers that would likely put you in the company of others. Avoid predictable combinations (1, 2, 3, 4, 5, 6 would be particularly bad) or birthdays.

But of course, there are factors other than math. If you enjoy daydreaming and savoring the excitement of having a chance at immense riches enough for that alone to be worth the $2 ticket, go for it. And if you don’t want to risk even the tiniest chance of ruining your personal life and being miserable the rest of your days, well, there’s that too.

*Explainer thanks Jordan Ellenberg of the University of Wisconsin and Irineo Cabreros at Princeton University.*