An efficient algorithm for computing the ith letter of φ n (a)

Let be a nite alphabet and let be a homomorphism i e a mapping satisfying xy x y for all x y Let a and let i n be integers We give the rst e cient algorithm for computing the ith letter of n a Our algorithm runs in time polynomial in the size of the input i e polynomial in logn log i and the description size of Our algorithm can be easily modi ed to give the distribution of letters in the pre x of length i of n a There are applications of our algorithm to computer graphics and biological modelling