Gregory,
>I do not use recursion as this will only slow down the process
While it is true that recursion has some overhead because it has to place information on the stack, most of the time it bypasses the overhead needed in a flat stack solution to circumvent the recursive nature of the optimum solution.
If you look at the solutions I provided in Message #
788088 and related to this problem
Re: Mathematics knundrum Thread #
780672 Message #
788120 you'll see that the given solutions are not only the fastest, but also the shortest and IMO als the most readable ones.
I think the problem is that many developers have difficulty in identifying when recursive algorithms are your best bet, and that they are not perticular familiar with them.
Of course recursive algorithms have their disadvantage too as stack/language nestin limitations (in VFP 128 levels).
Walter,