in reply to Re: dividend with recursive routine
in thread dividend with recursive routine

That formula assumes intermediate values can be non-integers. However, the OP wants to buy more shares with each years profit. And shares can only be bought as units. For instance, had the starting number of stock been 10 shares, it would have never increased, as the paid out yearly dividend would not have been enough to buy a new share.

For the OPs values, a starting value of 1000, an interest of 6.78% and 20 years, your formula results in 3714 (rounded to nearest integer). But if you can only buy shares in units, you end up with 3696 shares. Close, but still 0.5% difference.

Replies are listed 'Best First'.
Re^3: dividend with recursive routine
by CountZero (Bishop) on Aug 24, 2010 at 05:23 UTC
    Then I must have a better stockbroker than you, as I find partial shares in my account, which indeed automatically invests the dividends.

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

      It doesn't matter how good your stockbroker is. What matters is what the OP does. And the OP buys shares in units.