On Mon, 21 Jul 2008 04:18:17 -0400
"Rod Pemberton" <do_not_have@[EMAIL PROTECTED]
> wrote:
> But for length 4, some of the div indexes will exceed the
> string length... (Um, maybe?...)
Yes, for length 4, the maximum Pn will be 23, and so the initial
divisor must be 6. After which the remainder will become the Pn value
for a length 3 string, for which you already have the solution.
In the general case, for length L, the first divisor is (L-1)!, and
each iteration decrements the length by one. Thus this step is the
induction rule, and the length 3 case is the base case. Therefore the
generalized algorithm is valid for all possible string lengths.
Do you understand it now?
--
Chuck
http://www.pacificsites.com/~ccrayne/charles.html


|