How long will it take you to become a millionaire? The answer may depend on where you live.

You may dream of starting a company and hitting it big with several rounds of VC funding followed by a big exit--either an IPO or acquisition by a large company. Either event would likely make you a millionaire several times over, but both are pretty unlikely. Less than 1 percent of startups manage to get the VC funding that's usually needed to get to a multi-million-dollar exit. And even if you're lucky enough to raise VC funds, the odds are still three to one against your company going public or being acquired for a high price.

Fortunately, leading a startup to a lucrative exit is only one of many ways to become a millionaire. A much more straightforward approach, though not an especially sexy one, is to follow Warren Buffett's advice to invest wisely, live within your means, and get rich slowly but surely instead of taking a big gamble on trying to get rich quickly. 

Just how long does it take to do that? A lot depends on where you live, it turns out. The personal finance site GOBankingRates decided to do the research and figure out exactly how long it takes to become a millionaire in every state. Their study assumes that 1) You earn the median income for your state; 2) You spend the median cost of living for your state; and 3) You invest any surplus in a portfolio earning 5.5 percent a year, about average for a well-balanced portfolio of investments.

Surprisingly, the time it take to get to $1 million varies widely from state to state. The quickest time from zero to millionaire was in Maryland, where it takes just under 28 years to accumulate $1 million. The slowest was in West Virginia, where it takes over 109 years to accomplish the same thing. 

It's also surprising that the wealthiest states in the union are not the ones where you can get rich fastest. In California, home to Silicon Valley, it takes more than 40 years to accumulate $1 million. And in New York, where the presence of the financial industry boosts salaries into the stratosphere, it takes more than 69 years. The explanation may be that in these large, populous states, agriculture accounts for many residents' livelihood, so that the median income is lower than you might think if you only considered software developers in San Jose or stockbrokers in Manhattan. Meanwhile, out-of-control housing prices mean the cost of living is higher than elsewhere.

You can find the full list here. There are the states where you'll reach millionaire status fastest: 

1. Maryland

Time to accumulate $1 million - 27 years, 11 months and 6 days?

At $78,916 in 2018, Maryland is the state with the highest median household income in the nation, which explains why it's the fastest state to grow your bank account to $1 million. But if the District of Columbia counted at a state, it would beat Maryland at $82,372. That helps explain Maryland's high income, since a large portion of its residents are employed in D.C.

2. Utah

Time to accumulate $1 million - 31 years, 4 months and 16 days?

Utah's average household income of $65,325, isn't among the highest, but it's solidly above the national average of $57,652. Meanwhile, cost of living is slightly below the national average. It's a good combination, which is why Utah residents can save up $1 million relatively quickly.

4. Hawaii

Time to accumulate $1 million - 33 years, 3 months and 20 days

Median income in Hawaii is $74,923, much higher than the national average. On the other hand, cost of living in Hawaii is notoriously high too, in large part due to extremely high housing costs. Even so, it's a good place to live if you want to accumulate wealth. 

3. Alaska

Time to accumulate $1 million - 33 years, 4 months and 6 days??

Alaska has the third highest average income per household in the nation at $76,114. But the cost of living there is very high too--31.3 percent above the national average. This is due in part to the expense of transporting items, especially fresh produce, into the state, and also higher utility bills, given the climate. Still, according to GOBankingRates' calculations, it's the third fastest state in the national to save up $1 million. And GOBankingRates isn't taking into account Alaska's Permanent Fund Dividend, which is paid to every resident of the state who has lived there for more than a year, as payment for using the state's oil reserves. In 2018, the Permanent Fund Dividend was $1,600 per resident.

4. New Jersey

Time to accumulate $1 million - 36 years, 1 month and 17 days???

New Jersey's median household income is $76,475, the second highest in the nation behind Maryland, where the average household income is only about $2,500 a year higher. Residents of both states can easily take advantage of employment opportunities in a large neighboring city--Washington D.C. in Maryland's case, and New York City in New Jersey's case. New Jersey residents pour into Manhattan every day via the Path train, the George Washington Bridge, and the Lincoln and Holland Tunnels. New Jersey's cost of living is high, but nowhere near as high as New York City's. That makes New Jersey a good place to save up $1 million.