Solution (source code)

= Solution

Put $C=\alpha q^2/(4\pi\epsilon_0)$ with $\alpha=2\ln2$. Relative to a chosen positive ion, successive neighbours have alternating charge. The sum of its interactions with all other ions is $-C/R$. Summing this over all $2N$ ions would count every pair twice, so the total electrostatic <energy> is $-NC/R$, or $-C/R$ per ion pair.

There are $2N$ nearest-neighbour bonds in a periodic chain of $N$ pairs; boundary corrections are negligible for large $N$. If $A/R^n$ is the <energy> of \b[each] such bond, the repulsive contribution per ion pair is $2A/R^n$. Therefore the <alternating-charge chain cohesive energy> is
$$
\boxed{u(R)=\frac{U}{N}=-\frac{\alpha q^2}{4\pi\epsilon_0R}+\frac{2A}{R^n}.}
$$
The factor two in the short-range term counts two bonds per ion pair. If a repulsion parameter were instead defined as the whole pair's repulsive coefficient, it would equal $2A$ in this convention; changing that definition must not silently change the equilibrium formula. The absolute zero of <energy> is separated ions for a genuinely decaying repulsion.