The faces of $n$ unit cubes have been painted either black or white at random. What is the probability that these cubes can be lined up to make a 'white train' , an $1 \times 1 \times n$ box which only white faces are visible ? I have found that for the middle cubes will need $6C6+6C5+6C4+6C3$ possible arrangements and there are a total of $2^{64}$ TOTAL arrangements .
What is tough is how to find the 'ends' or how many arrangements will result in the ends of this 'train' being white too. I computed $24$ ways since for each face there are $4 \times 6$ ways.
Note: The following calculation is for a $1\times n$ train with all 6 faces white.
Method 1: Elementary Counting
Firstly assume each cube can have either:
then, as there are $n$ cubes there are $(1+6+3)^n=10^n$ colourings of types 1, 2 and 3.
However, we have over counted since there are, amongst our $10^n$ colourings, $3^n$ colourings that have exactly $n$ cubes with $2$ opposite black faces, and $\binom{n}{1}\cdot (6+1)\cdot 3^{n-1}$ colourings that have exactly $n-1$ cubes with $2$ opposite black faces.
Subtract these to give
$$10^n-3^n-7n\cdot 3^{n-1}$$
colourings which allow us to form a white train.
Since each cube has $6$ faces, each cube has $2^6$ total possible colourings. Then, as there are $n$ cubes, there are $2^{6n}$ total colourings of all the $n$ cubes, so the probability of being able to form a white train is:
$$\frac{10^n-3^n-7n\cdot 3^{n-1}}{2^{6n}}\tag{Answer}$$
Method 2: Using Exponential Generating Functions
I orginally formulated the problem in terms of exponential generating functions (egfs). For completeness here is what I did:
Formulate an egf for cube colourings with $0$ ($z_0$) or $1$ ($z_1$) black face. There must be at least $2$ of these so it's egf is:
$$\frac{1}{2!}(z_0+6z_1)^2+\frac{1}{3!}(z_0+6z_1)^3+\frac{1}{4!}(z_0+6z_1)^4+\cdots=e^{z_0+6z_1}-(z_0+6z_1)-1$$
Next formulate an egf for cube colourings with $2$ opposite black faces ($z_2$). There can be any number of these so we have it's egf:
$$1+\frac{1}{1!}(3z_2)+\frac{1}{2!}(3z_2)^2+\frac{1}{3!}(3z_2)^3+\cdots=e^{3z_2}$$
Multiply these together to give our egf that enumerates valid colourings
$$(e^{z_0+6z_1}-(z_0+6z_1)-1)e^{3z_2}$$
where the coefficient of $z_0^{k_0}z_1^{k_1}z_2^{k_2}$ tells us the number of valid colourings with $k_0$ all white cubes, $k_1$ cubes with $1$ black face and $k_2$ cubes with $2$ opposite black faces.
We are only interested in enumerating according to the total number of cubes so we need not distinguish $z_0$, $z_1$ and $z_2$: put $z_0=z_1=z_2=z$ then the desired egf is now:
$$(e^{7z}-7z-1)e^{3z}=e^{10z}-7ze^{3z}-e^{3z}$$
and taking the $z^n/n!$ coefficient gives us the desired count for valid colourings:
$$[z^n/n!](e^{10z}-7ze^{3z}-e^{3z})=10^n-7n\cdot 3^{n-1}-3^n$$
as before. Which then leads to the same probability.