The two parts of this Memoir contain two separate but related papers. The longer paper in Part A obtains necessary and sufficient conditions for several types of codings of Markov chains onto Bernoulli shifts. It proceeds by replacing the defining stochastic matrix of each Markov chain by a matrix whose entries are polynomials with positive coefficients in several variables; a Bernoulli shift is represented by a single polynomial with positive coefficients, $p$. This transforms jointly topological and measure-theoretic coding problems into combinatorial ones. In solving the combinatorial problems in Part A, we state and make use of facts from Part B concerning $p^n$ and its coefficients. Part B contains the shorter paper on $p^n$ and its coefficients, and is independent of Part A. An announcement describing the contents of this Memoir may be found in the Electronic Research Announcements of the AMS at the following Web address ams.org/era.