Impurity-related energies of semiconducting superlattices: Periodicity and magnetic-field effects