Markov Chain Contest Problem Five cards labeled 1, 3, 5, 7, 9 are laid in a row in that order, forming the five-digit number 13579 when
read from left to right. A swap consists of picking two distinct cards, and then swapping them. After
three swaps, the cards form a new five-digit number n when read from left to right. Compute the
expected value of n.
I have shown my attempt to solve the problem in an answer.  Could someone vet the solution.
 A: Here's a slightly simpler way of calculating the exact expected value of $\ n\ $.  After the OP's correction to my original calculation (in which I made an arithmetical error), it gives the same answer as his.
After $3$ swaps, there will be a probability $\ p\ \ \big($which turns out to be $\ \frac{3}{10}\ \big)
 $ that the digit in any given place will be the same as it was at the start, and a probability of $ \frac{1-p}{4}\ \left(=\frac{7}{40}\right)\ $ that it will be any one of the other $4$ digits.  The expected value of $\ n\ $ is therefore
\begin{align}
10^4\Big(&p\cdot1+\frac{(1-p)(25-1)}{4}\Big)+10^3\left(p\cdot3+\frac{(1-p)(25-3)}{4}\right)\\
&+10^2\Big(p\cdot5+\frac{(1-p)(25-5)}{4}\Big)+10\left(p\cdot7+\frac{(1-p)(25-7)}{4}\right)\\
&\hspace{1.5em}+p\cdot9+\frac{(1-p)(25-9)}{4}\\
&\hspace{3em}=\left(\frac{5p-1}{4}\right)13579+\left(\frac{25(1-p)}{4}\right)11111\\
&\hspace{3em}=\frac{13579+35\cdot11111}{8}\\
&\hspace{3em}=50308
\end{align}
You can calculate the value of $\ p\ $ by treating the presence or absence of the original digit in any place as a two-state Markov chain with transition matrix
$$
\pmatrix{\frac{3}{5}&\frac{2}{5}\\\frac{1}{10}&\frac{9}{10}}\ ,
$$
since the probability is $\ \frac{1}{10}\ $ that a single swap will return any given digit back to its original place once it has been swapped out of it.  The initial state of the chain is $1$, and there are $4$ sequences of states that end with with the digit originally in the place being back there after $3$ swaps.  Those sequences and their probabilities are:
$$
\begin{array}{cc}
\text{state sequence}&\text{probability}\\
1111&\left(\frac{3}{5}\right)^3=\frac{27}{125}\\
1121&\left(\frac{3}{5}\right)\left(\frac{2}{5}\right)\left(\frac{1}{10}\right)=\frac{3}{125}\\
1211&\left(\frac{2}{5}\right)\left(\frac{1}{10}\right)\left(\frac{3}{5}\right)=\frac{3}{125}\\
1221&\ \left(\frac{2}{5}\right)\left(\frac{9}{10}\right)\left(\frac{1}{10}\right)=\frac{9}{250}\ ,
\end{array}
$$
and the sum of these probabilities is $\ \frac{3}{10}\ $, as stated above.
A: Let there be five states 1, 3, 5, 7 and 9.  The probability that 1 will be swapped with 3 is $\frac{1}{10}$. Similarly the probabiilty that 1 will be swapped with other numbers will be the same. Proability that 1 will not be swapped is $\frac{6}{10}$ The first matrix is the transition matrix and it is exponentiate three times to signify the three swaps and the last matrix is the probability weighted sum of all instances. The prob that 1 would remain 1 is $0.3$ after three swaps times the value of the digit times the place of the digit 10^4  = 3000.
Thus it is a markov chain with the transition matrix as shown in the excel image and the expected $n = 50308$

