Solution (source code)

= Solution

\b[True.] Suppose $A,B$ are real and $AP=PB$ for an invertible complex <matrix> $P=X+iY$, with $X,Y$ real. Taking real and imaginary parts gives
$$
AX=XB,\qquad AY=YB.
$$
The <polynomial> $q(t)=\det(X+tY)$ is not identically zero, since $q(i)=\det P\ne0$. Choose a real $t$ outside its finite zero set. Then $Q=X+tY$ is real and invertible, and $AQ=QB$. Thus $A$ and $B$ are conjugate over $\mathbb R$, as stated by <complex similarity of real matrices implies real similarity>.