Why is the number of molecules in a standard volume of gas at a standard temperature and pressure a constant, regardless of the molecule's composition or weight? Let's say I have a closed box full of a heavy gas, one meter on a side. It has a certain number of molecules inside. I want to be able to add a lighter gas to the box without changing its internal pressure (or temperature), so I connect a cylinder to the side of the box, which holds a frictionless piston for expansion (the piston has a constant force applied to it, to maintain a constant pressure inside the box and allow the volume of the gas to grow as new gas is introduced into the box). Now I add Helium to the box. The piston moves back to maintain constant pressure, but why does the number of molecules in the box proper stay constant? My mental image of this is that it would be like adding water to a bucket of marbles, and that, evidently, is wrong, but why is it wrong?
Dear Wade, your good question is easily answered if you consider "pressure" to be a derived quantity, and let us derive it.
An average molecule (or atom) of an ideal gas - and your proposition only holds for an ideal gas - has kinetic energy equal to $$mv^2/2=3kT/2$$ It's because every degree of freedom carries $kT/2$ and there are three degrees of fredom in translations. Note that lighter molecules will move faster than the heavier ones.
How do we calculate the pressure? Well, put the molecule in a cubic box of volume $a^3$. It will hit the walls - the total surface of the cube is $6a^2$. We need to compute the average (over molecules) transfered momentum per unit time - this is called the force - and divide it by the area to compute the pressure of one molecule.
The force on the wall may be in $x,y,z$ directions. Let's consider the $x$ direction. The velocity of a particular molecule in the $x$-direction is $v_x$, so it takes $a/v_x$ of time to get from one side to the other side of the box in the $x$ direction. Once it gets to the other side, it bounces off the wall and changes the sign of the $x$-component of the velocity (and momentum). At this moment, the momentum $p_x$ clearly changes the sign - i.e. changes by $2p_x$.
So the change of momentum $p_x$ per unit time is $$F_x = 2p_x / (a/v_x) = 2p_x/(am/p_x) = 2p_x^2/am$$ That's equal to $4/a$ times the kinetic energy $K_x$ in the $x$-direction. The pressure is $$p = (F_x+F_y+F_z) / 6a^2 = 3\times 4/a\times K_x / 6a^2 = 4K/a / 6a^2 = 2K/3a^3 $$ But as I have said, the average kinetic (motion) energy per molecule is $K=3kT/2$ where $T$ is the absolute temperature, so the pressure is $$p = 2k/3a^3 = kT/a^3= kT/V$$ Note that we have just derived $pV=kT$ for one molecule or $pV=NkT$ for $N$ molecules - which is what we wanted. The mass of the molecule canceled: if the molecule is heavier, the average velocity at a given temperature is slower. But that doesn't matter - because the molecule has a greater momentum (because of the higher mass) which is compensated by the longer time it needs to get from one side to the other to transfer this momentum.
So for a fixed temperature, the pressure is independent of the molecule type.
Avogadro's hypothesis holds only for ideal gases. For example, if we take a van der Waals gas with equation of state $$ (P + n^2 a / V)(V - n b) = nRT $$ it is easy to see that, for fixed $P$, $V$, $T$, the number of moles $n$ depends on the parameters $a$ and $b$, which in general will change from one type of gas to the other.
"My mental image of this is that it would be like adding water to a bucket of marbles, and that, evidently, is wrong, but why is it wrong?"
To the extent that a gas can be represented by the "ideal gas" model, the volume of the gas molecules is negligible compared to the volume of the container. Your intuition would apply in the limit of very high densities.
For the ideal gas case, you might think of the volume as being supported by pressure in a manner similar to how popping popcorn can support a volume in excess of the volume of the popcorn itself. It happens dynamically; the volume is almost entirely empty of molecules.