It's often helpful to draw a diagram showing the energy levels for the particular element you're interested in. The diagram for hydrogen is shown above.
The n = 1 state is known as the ground state, while higher n states are known as excited states. If the electron in the atom makes a transition from a particular state to a lower state, it is losing energy. To conserve energy, a photon with an energy equal to the energy difference between the states will be emitted by the atom.
Consider the photon emitted when an electron drops from the n=4 to the n=2 state to the photon emitted when an electron drops from n=3 to n=2. Which photon has the longer wavelength?
The smaller the energy the longer the wavelength. The photon has a smaller energy for the n=3 to n=2 transition.
In the hydrogen atom, with Z = 1, the energy of the emitted photon can be found using:
E = (13.6 eV) [1/nf2 - 1/ni2]
Atoms can also absorb photons. If a photon with an energy equal to the energy difference between two levels is incident on an atom, the photon can be absorbed, raising the electron up to the higher level.
The electron in a hydrogen atom is in the n = 2 state. When it drops to the ground state a photon is emitted. What is the wavelength of the photon? Is this in the visible spectrum?
One way to do this is to first calculate the energy of the electron in the initial and final states using the equation:
En = (-13.6 eV)/n2
E2 = (-13.6 eV)/4 = -3.4 eV
E1 = (-13.6 eV)/1 = -13.6 eV
In dropping from the n = 2 state to the ground state the electron loses 10.2 eV worth of energy. This is the energy carried away by the photon.
Converting this to joules gives E = 10.2 * 1.60 x 10-19 J/eV = 1.632 x 10-18 J
For a photon E = hf = hc/λ
λ = hc/E = 6.63 x 10-34 * 3 x 108 / 1.632 x 10-18
λ = 1.22 x 10-7 m = 122 nm
This is in the ultraviolet part of the spectrum, so it would not be visible to us.