What keeps electrons from becoming attached to protons in the nucleus?
That is an excellent question. It is in fact one of the key questions that led to the development of quantum mechanics.
Let us consider the hydrogen atom, one proton and one electron. You can reasonably imagine a particle like an electron with an negative charge orbiting a positively charged proton in exactly the same way that a satellite orbits the earth, both the electrostatic attraction and the gravitational attraction being inverse square laws. But an accelerating charged particle (and circular motion with a constant change in direction is an accelerating motion) must radiate energy in accordance with Maxwell's equations. So an electron orbiting a nucleus would be radiating energy, slowing and ought therefore to spiral into the nucleus. But it doesn't and this was a puzzle.
But quantum theory came to the rescue to provide an explanation. de Broglie postulated that all moving objects, like the electron orbiting the nucleus have an associated wavelength.
Bohr proposed that an electron orbiting a nucleus could only have an orbit in which the circumference was an integral number of wavelengths. This implies that there are only discrete energies that are allowable for the electron orbiting the nucleus, and therefore it cannot continually radiate energy away. This theory accurately predicts the emission spectra for hydrogen and provides an explanation for why the atom is stable.
*from a Space.com forum, post by DrRocket
Why is an atomic number always calculated from the number of protons in the nucleus not from the number of electrons?
The number of protons in a nucleus depends on which element it is. ( The number of protons is the decider as to which element it is. ) The number of electrons in an atom is the same as the number of protons in the nucleus, but none of the electrons are in the nucleus. Rather, they orbit around the nucleus like planets round a star.
An ion is an atom that has more or less electrons than the number of protons in its nucleus. In the neutral atom, the number of electrons equals the number of protons in the nucleus. In a positive ion, there are fewer electrons than protons in the nucleus, and in a negative ion, there are more electrons than protons in the nucleus.