Analysis of magnesiumlike spectra from Cu XVIII to Mo XXXI