In our previous email we proved that, for non-prime b, k(b,b^n/t)=t*(b-1) (1<t<b, b^n/t integer) We showed this value is maximized when t is the largest value less than b, that does not contain a prime factor not contained also in b. We surmised that this is the maximum attainable value for k(b). We prove this here. Consider an arbitrary nonnegative integer x. Assume b not prime. Assume x%b > 0 (because for non-prime b, k(b,x)==k(b,x*b)). For a given n, define T(x,n)={xi%b^n|i integer >=0}, and define t(x,n)=|T(x,n)|. Clearly t(x,n) = b^n/gcd(x%b^n, b^n). T(x,n) is the number of distinct values (xi%b^n) can take on; these values are exactly the 0 point, plus the points needed to break the interval (0..b^n) into equal pieces. If t(x,n)>=b, then the digit at position n-1 of these distinct values includes all the values from {0..b-1}; otherwise, at least the value b-1 is omitted. For the given value x, let n be the largest value for which t(x,i)<b, 0<=i<=n. n=0 always works, so there will always be such a value. This is our demarcation point. Define a=floor(x/b^n)%b^n (the digit above the demarcation point). Define t=t(x,n). Define c=(x%b^n)/t. Note that 1<=c<t<b, and gcd(c,b)=1. We already know that, since b^n/t is an integer and 1<t<b, that k(b,b^n/t)=t*(b-1). Since this is always greater than b for non-prime b, we can ignore the digit 0 and thus dispense with any concern for dropping the leading digits, since the 0 will always be handled by the least significant digit of x*b. We will prove that k(b,x)<=t*(b-1). Indeed, we show that the digit to the left of the demarcation point, alone, will see all digit values within that span. There are t(x,n+1) possible values at digit position n. By definition of the demarcation point, this is >=b, and these values are evenly distributed. Let us calculate t(x,n+1). The n low-order digits of the values in T(x,n+1) are clearly just those permitted by T(x,n); there are t such values. In addition there are b possible values for digit position n in T(x,n+1), so we know t(x,n+1)<=t*b. We also know that the first t(x,n+1) values for (xi%b^{n+1}) (for i=0..t(x,n+1)) generate the same set as T(x,n+1) because t(x,n+1)*x evenly divides b^{n+1}. The values (xi%b&{n+1}) for 0..t*(b-1) will either cover the set T(x,n+1) completely (in the case where t(x,n+1)<t*b), or cover all but t-1 of the points from T(x,n+1). Since the values in T(x,n+1) are uniformly distributed and, if t(x,n+1)=t*b, there are exactly t values for each possible most significant digit, this means we must have covered all of the digits at least once. Thus, k(b,x) <= k(b,b^n/t) = t*(b-1). This proves that k(b) is k(b,b^n/t) = t*(b-1), where t is the largest value less than b that does not contain a prime factor that is not also in b. This solves Wilson's puzzle for non-prime b. We've already solved it for prime p, so this completes the solution. (I've tested this against known results through b=3900 and it holds up.)