I have an air mass which consists of 78.1% $\ce{N_2}$, 20.9% $\ce{O_2}$, 0.964% $\ce{Ar}$, and 0.0378% $\ce{CO_2}$ in a container which volume $\mathrm{V=40~L}$ at a temperature $\mathrm {T = 298.15~K}$.
The total pressure is $\mathrm{p_{total} = 1.5~atm}$.
Now I am removing all the $\ce{O_2}$ in the container. What will the partial pressure of $\ce{N_2}$ be?
I know the formula $\mathrm{pV = nRT}$.
Before I remove all the $\ce{O_2}$ I can calculate the amount of substance $$\mathrm{{n_{total} = \frac{pV}{RT} = \frac{1.5 \cdot 40}{0.082 \cdot 298.15}~mol = 2.45~mol}}$$.
The molar mass of $\ce{N_2}$ and $\ce{O_2}$ is $\ce{M(N_2)} = \mathrm{28~g\ mol^{-1}}$ and $\ce{M(O_2)} = \mathrm{32~g\ mol^{-1}}$.
If I remove all the $O_2$ the new mass/volume percentage of $\ce{N_2}$ will be
$$\mathrm{m_\%(N_2) = \frac{78.1}{78.1+0.964+0.0378} = 98.7 \%}$$. So I thought I could find the amount of substance of $\ce{N_2}$ by saying $$\ce{n(N_2)} = \mathrm{\frac{98.7~g}{28~g/mol} = 3.525~mol}$$ but this will exceed the total amount of substance before I removed $\ce{O_2}$ so this makes no sense.
When I have found the amount of substance of $\ce{N_2}$ I think I can just replace $\ce{n}$ in $\mathrm{p = \frac{nRT}{V}}$ and get the partial pressure of $\ce{N_2}$.
Maybe I have the right percentage of $\ce{N_2}$ but I am calculating the amount of substance wrong when it's a gas? Could the correct answer be $\mathrm{98.7 \% \cdot n_{total} = 2.422~mol}$ and then inserting this in $\mathrm{p = \frac{nRT}{V}}$ which gives me around $\ce{p(N_2)} = \mathrm{1.5~atm}$?