Stability of isotopes is affected by the ratio of protons to neutrons, and also by presence of certain magic numbers of neutrons or protons which represent closed and filled quantum shells. These quantum shells correspond to a set of energy levels within the shell model of the nucleus; filled shells, such as the filled shell of 50 protons for tin, confers unusual stability on the nuclide. As in the case of tin, a magic number for Z, the atomic number, tends to increase the number of stable isotopes for the element.
Just as in the case of electrons, which have the lowest energy state when they occur in pairs in a given orbital, nucleons (both protons and neutrons) exhibit a lower energy state when their number is even, rather than odd. This stability tends to prevent beta decay (in two steps) of many even–even nuclides into another even–even nuclide of the same mass number but lower energy (and of course with two more protons and two fewer neutrons), because decay proceeding one step at a time would have to pass through an odd–odd nuclide of higher energy. Such nuclei thus instead undergo double beta decay (or are theorized to do so) with half-lives several orders of magnitude larger than the age of the universe. This makes for a larger number of stable even–even nuclides, which account for 150 of the 251 total. Stable even–even nuclides number as many as three isobars for some mass numbers, and up to seven isotopes for some atomic numbers.
Conversely, of the 251 known stable nuclides, only five have both an odd number of protons and odd number of neutrons: hydrogen-2 (deuterium), lithium-6, boron-10, nitrogen-14, and tantalum-180m. Also, only four naturally occurring, radioactive odd–odd nuclides have a half-life over a billion years: potassium-40, vanadium-50, lanthanum-138, and lutetium-176. Odd–odd primordial nuclides are rare because most odd–odd nuclei are unstable with respect to beta decay, because the decay products are even–even, and are therefore more strongly bound, due to nuclear pairing effects.
Yet another effect of the instability of an odd number of either type of nucleons is that odd-numbered elements tend to have fewer stable isotopes. Of the 26 monoisotopic elements (those with only a single stable isotope), all but one have an odd atomic number, and all but one has an even number of neutrons—the single exception to both rules being beryllium.
The end of the stable elements in the periodic table occurs after lead, largely due to the fact that nuclei with 128 neutrons—two neutrons above the magic number 126—are extraordinarily unstable and almost immediately shed alpha particles. This also contributes to the very short half-lives of astatine, radon, and francium relative to heavier elements. A similar phenomenon occurs to a much lesser extent with 84 neutrons—two neutrons above the magic number 82—where various isotopes of elements in the lanthanide series exhibit alpha decay.