Solution (source code)

= Solution

Take the <electrostatic potential energy> to vanish for infinitely separated <point charges>, and write $k_e=1/(4\pi\epsilon_0)$. The first charge costs no work to place. Bringing the second to distance $a$ costs $k_eq^2/a$; the third is distance $a$ from both existing charges and costs $2k_eq^2/a$. Thus the external quasistatic assembly work is
$$
\boxed{W=U=\frac{3q^2}{4\pi\epsilon_0a}}.
$$
Equivalently, sum over the three distinct pairs in the <equilateral triangle>. Counting both ordered pairs without a compensating factor of one half would double the answer. The positive result applies to either sign of $q$, since all three <electric charges> have the same sign.