NOTE: This is NOT to be considered financial advice. Please verify all calculations yourself and use sober judgement in your decisions!
Q: In how many years will a onetime investment at a fixed APY (or an unpaid loan at a fixed APR) double its value at an interest rate of r (e.g. r = 3% = 0.03)?
A: What may surprise you is that the number of years to double depends only on the interest rate, and not on the initial amount.
Take an initial investment amount, call it P. This amount will grow at the APY rate of every year, so our formula for growth becomes 2*P = P*(1 + r)^n where n is the number of years. To solve for n, we use a logarithm, and wind up with a final answer of n = log(2)/log(1 + r).
For an APY, APR, or growth rate of 3% per year, a onetime investment, an unpaid loan, or any other sum will double in its value in 23.45 years, or 23 years, 5 months, and 12 days. See the table below for more doubling times.
APY/APR/Growth Rate  0.5%  1.0%  1.5%  2.0%  2.5%  3.0%  3.5%  4.0%  4.5%  5.0% 
Years to double (rounded to nearest year)  139  70  47  35  28  23  20  18  16  14 
What does this mean in plain English, and what can we say about these numbers? Take a 30year fixed mortgage for $500,000 at an APR of 4.5% as an example. If you pay 20% down on this amount, the loan you will need is $400,000. As a rough approximation, assume that you make payments of $200,000 in the first 15 years (a monthly payment of $1111.11). At this point you will have dished out $300,000 over a period of 15 years, and you will owe more than the original loan was worth. Why? Since you only paid half the original amount in 15 years, the remaining balance on the loan has had time to double. Not only has it had time to double, but the amount that doubled wasn't $200,000  it was higher!
Now let's take a more positive example. Suppose you have a savings account with a generous interest rate of 3.5% that you make a onetime deposit of $10,000 into. After approximately 20 years (assuming that the interest rate has remained constant and you have not withdrawn any money), you will have $20,000 in the savings account.
Q: How many times must I double an initial investment of $1000, $10,000, or P dollars to have a sum of $1,000,000?
A: Let's develop a formula to describe this relationship. Let n be the number of times we double. The new amount of money we have after doubling once is 2*P, after doubling twice is 2*(2*P), after doubling three times is 2*(2*(2*P)), and so on. This results in the formula Q = P*2^n where Q is the amount of money after doubling P a number of n times. Solving this equation for n gives n = log(Q/P)/log(2).
Assuming there is no capital gains tax (bad assumption!) the number of times you need to double an initial investment for several different dollar amounts in order to have a sum of $1,000,000 is given below in the table.
Initial investment  $0.01  $1  $10  $100  $500  $1000  $5000  $10,000  $50,000  $100,000 
Number of doubles to $1,000,000 (rounded up)  27  20  17  14  11  10  8  7  5  4 
