The $5k figure is in 2018 dollars and the rate of return is inflation-adjusted.
>>> def comp(s, n, i):
... m = 0
... for x in range(n):
... m *= i
... m += s
... return m
...
>>> comp(5000, 77, 1.062)
8201943.704759633
So there were some abnormal returns (or inheritance) involved.Where is the '2018 dollars'? The account takes the same nominal deposit at year 0 as at year 76.
Where is the adjustment for inflation in the interest rate? The account adds 6.2% every year regardless of that years inflation.
EDIT: The program obviously cannot account for inflation since it has no notion of inflation. If the secretary were depositing 5000 '2018 dollars' in 1947, then the nominal deposit would have to be something like $500. Inflation is usually positive, so money in the past is worth more.
Average dividend reinvested and inflation adjusted return between 1949 and 2016 is 7.5%
>>> def comp(A, n, i):
... m = 0
... for x in range(n):
... m += i**x
... return A/m
...
>>> comp(9000000, 67, 1.0725)
6053.012676780852
Assuming costs of 0.25%, she needs to invest a little over 6000 2016 USD per year to get 9 million USD.