Solution (source code)

= Solution

Use number concentrations and write the <electrochemical potential> of a sodium ion as $\widetilde\mu=\mu^\circ+k_{\rm B}T\ln c+e\psi$. Define the inward <sodium-motive force> as available work per positive charge for transport from outside to inside. With $V_m=\psi_i-\psi_o$,
$$
\boxed{\mathcal E_{\rm Na}=\frac{\widetilde\mu_o-\widetilde\mu_i}{e}=\frac{k_{\rm B}T}{e}\ln\frac{c_o}{c_i}-V_m.}
$$
Its negative is the signed inward free-energy cost per charge; stating this direction removes a common sign ambiguity.

Long-open sodium channels establish electrochemical equilibrium, $k_{\rm B}T\ln(c_{i0}/c_o)+eV_{m0}=0$. This does not generally require equal concentrations: impermeant counterions can support a nonzero equilibrium <membrane potential>. Let $n_0=c_{i0}V$. For a large fixed-concentration external reservoir, after pumping $n$ ions out, $c_i(n)=(n_0-n)/V$ and $V_m(n)=V_{m0}-ne/C$. The <sodium export cost from a capacitive vesicle> for exporting another ion is
$$
\Delta G_{\rm Na}(n)=k_{\rm B}T\ln\frac{c_oV}{n_0-n}-eV_{m0}+\frac{ne^2}{C}=\boxed{\frac{ne^2}{C}+k_{\rm B}T\ln\frac{n_0}{n_0-n}}.
$$
The initial-equilibrium relation was used in the last step. The first term is the incremental electrical cost and the second is the change in chemical cost from their initial balanced values.

If the intended initial reference is uncharged with $V_{m0}=0$ and $c_{i0}=c_o$, then $n_0=c_oV$ and the requested form in the listed variables is
$$
\boxed{\Delta G_{\rm Na}(n)=\frac{ne^2}{C}+k_{\rm B}T\ln\frac{c_o}{c_o-n/V},\qquad 0<n<c_oV.}
$$
That equal-concentration reference is an additional assumption. For example, $c_{i0}=2c_o$ and $V_{m0}=-(k_{\rm B}T/e)\ln2$ also give zero initial sodium flux, but a different ion inventory. Thus the open-channel condition alone cannot determine $n_0$ from $c_oV$. If concentrations are molar rather than number densities, use the corresponding <Avogadro constant> conversion and $RT$ for molar free energies. Treating the capacitor charge discretely gives a charging-energy increment $(n+1/2)e^2/C$ rather than the differential $ne^2/C$; the distinction is negligible for the thousands of ions used next.