Why is nucleus charge squared in Rydbergs formula? According to coulumbs law, the energy changes linearly with charge. So why is the nucleus charge squared in this formula? Is there a way to derive it?

I was suspecting it might be because it pulls the electron closer too.
Derivation comes from the formula for electrostatic potential energy.

The electrostatic potential between the point charges of an electron, and a proton would be represented by the formula

$$U_E(r) = k_e \frac{q_eQ_p}{r}$$

However, in the derivation that we are looking at a difference of energy is from an emission or absorption, such that the energy concerned is 

$$E_i - E_f$$

The subtraction appears in the Rydberg formula from the distance in the form

$$\left( \frac {1} {n_1^2} - \frac {1} {n_2^2} \right)$$

However, the terms other than the radius are multiplied together and come outside the parentheses.  Even though we are looking at only a single electron, the term for the charge in the nucleus is squared because of this. This can be seen in the Bohr derivation of the Rydberg formula. 

$$E = h\nu = E_i - E_f = \frac {m_eq_e^2q_Z^2} {8h^2\epsilon_0} \left( \frac {1} {n_f^2} - \frac {1} {n_i^2} \right)$$

This shows the origin of the squared term for the nuclear charge which correlates with the Rydberg formula for a hydrogen-like element since all terms outside the parentheses other than charge are constant.

$$\frac {1} {\lambda_{vac}} = RZ^2\left( \frac {1} {n_1^2} - \frac {1} {n_2^2} \right)$$