Solution (source code)

= Solution

Let $X_i=\mathbf1_{A_i}$ be the <indicator random variable> of $A_i$. Then $X=\sum_iX_i$, so <linearity of expectation> gives
$$
\boxed{\mathbb E X=\sum_{i=1}^n\mathbb E X_i=\sum_{i=1}^n\mathbb P(A_i)}.
$$
Using <variance of a sum> and
$$
\operatorname{Cov}(X_i,X_j)
=\mathbb E(X_iX_j)-\mathbb E X_i\mathbb E X_j
=\mathbb P(A_i\cap A_j)-\mathbb P(A_i)\mathbb P(A_j),
$$
we obtain
$$
\boxed{\operatorname{Var}(X)=\sum_{i=1}^n\sum_{j=1}^n
\left[\mathbb P(A_i\cap A_j)-\mathbb P(A_i)\mathbb P(A_j)\right]}.
$$

For the circular array, let $X_i$ indicate that bulbs $i$ and $i+1$ are both on, with indices read modulo $n$. Then $\mathbb E X_i=p^2$. Non-neighbouring indicators are independent, while
$$
\operatorname{Var}(X_i)=p^2-p^4,
\qquad
\operatorname{Cov}(X_i,X_{i+1})=p^3-p^4.
$$
There are $n$ individual terms and $2n$ ordered neighbouring pairs in the double covariance sum, so
$$
\boxed{\mathbb E X=np^2},
\qquad
\boxed{\operatorname{Var}(X)=n(p^2+2p^3-3p^4)}.
$$

The event $B$ is exactly $\{X\geq1\}$. If $p=n^{-0.6}$, <Markov inequality> gives
$$
\mathbb P(B)\leq\mathbb E X=np^2=n^{-0.2}\longrightarrow0.
$$
If $p=n^{-0.4}$, then $B^c=\{X=0\}$ implies $|X-\mathbb EX|\geq\mathbb EX$. By <Chebyshev inequality>,
$$
\mathbb P(B^c)\leq\frac{\operatorname{Var}(X)}{(\mathbb EX)^2}
=\frac1{np^2}+\frac2{np}-\frac3n
=n^{-0.2}+2n^{-0.6}-3n^{-1}\longrightarrow0.
$$
Therefore $\boxed{\mathbb P(B)\to1}$ in the second regime.