I need to calculate the probability distribution (p.m.f.) of $X=X_1X_2 \cdot \cdot \cdot X_n$ where $X_i \in \{1,2\}$ and $X_i$ are iid with probabilities $p$ and $1-p$ respectively.
Since $X=2^n$ for $n \in\mathbb{N}$, then rather than inferring the distribution directly, one could consider $\log_2(X)=log_2(X_1)+log_2(X_2)+ \cdot \cdot \cdot +log_2(X_n)$ that's known to have a binomial distribution of some sort (because $X_1+ \cdot \cdot \cdot + X_n$ of bernoulli r.v.s has).
But if one infers the distribution in $log_2$ scale (and what's the p.m.f. of $\log_2(X)$?), then how do I transform back to the original scale?
Let $X_n$, $n=1,2,\ldots$ be i.i.d. random variables with $$\mathbb P(X_1=1) = p = 1-\mathbb P(X_1=2). $$ For each positive integer $n$, let $$Y_n = \prod_{j=1}^n X_j,$$ then $$\mathbb P(Y_1=1)=p=1-\mathbb P(Y_1=2). $$ Suppose for some integers $n,k$ such that $0\leqslant k\leqslant n$ and $n>0$, $$\mathbb P\left(Y_n = 2^k\right) = \binom nk (1-p)^kp^{n-k}. $$ Then for $0\leqslant k\leqslant n+1$ we have \begin{align} \mathbb P\left(Y_{n+1}=2^k\right) &= \mathbb P\left(X_{n+1}Y_n = 2^k\right)\\ &=\mathbb P\left(X_{n+1}Y_n = 2^k\mid X_{n+1}=1\right)\mathbb P(X_{n+1}=1)\\ &\quad+\mathbb P\left(X_{n+1}Y_n = 2^k\mid X_{n+1}=2\right)\mathbb P(X_{n+1}=2)\\ &= \mathbb P\left(Y_n=2^k\right)\mathbb P(X_{n+1}=1) + \mathbb P\left(Y_n=2^{k-1}\right)\mathbb P(X_{n+1}=2)\\ &= p\binom nk (1-p)^kp^{n-k} + (1-p)\binom n{k-1} (1-p)^{k-1}p^{n+1-k}\\ &= \left(\binom nk + \binom n{k-1}\right)(1-p)^kp^{n+1-k}\\ &= \binom {n+1}k (1-p)^kp^{n+1-k}. \end{align} It follows by induction that $\xi_n := \lg Y_n$ has $\operatorname{Bin}\left(n,1-p\right)$ distribution, that is, $$\mathbb P(\xi_n = k) = \binom nk (1-p)^kp^{n-k}. $$