|
|
back to boardexplanation of the algorithm a[0] := 1; a[1] := k-1; a[i] := (k-1)*(a[i-1] + a[i-2]); why? could someone explain it? thanks a bunch!! Re: explanation of the algorithm 1. I do not really understand why a[0]=1 2. My assumptions were a[1]=k-1 and a[2]=k*(k-1). (It fits for your assumptions) 3. Anyway... for any k and n: a. First digit is nonzero => Quantity of possible first digits k-1. Multiplying it by a[n-1] we have (k-1)*a[n-1]. Requirements are satisfied because a[n-1] numbers have leading nonzero also. b. First digit nonzero, second - zero, then a[n-2] numbers that are leading with nonzero again. (k-1)*a[n-2]. c. As result (k-1)*(a[n-1]+a[n-2]) Edited by author 13.03.2005 21:17 Re: explanation of the algorithm thank you very much indeed! |
|
|