Based on the Boltzmann distribution in local thermodynamic equilibrium, the partition functions for N I, N II, N III, and N IV and O I, O II, O III, and O IV were investigated by including highly excited energy levels. Through adding the Debye corrections into the Saha equation, the particle number density for air plasma was studied for various electron temperature ( \(T_e\) ) and electron density ( \(n_e\) ) by about 10,000–40,000 K and 5 \(\times \) 10 \(^{15}\) –10 \(^{21}\) cm \(^{-3}\) . Then, the corresponding abundance for air plasma was gained. Moreover, the changing tendency of particle number density and abundance in air plasma were applied to a lightning plasma when combined with its spectral diagnosis on \(T_e\) and \(n_e\) . The measured particle number density for N I, N II, N III, O I, and O II, separately, are 1.20 \(\times \) 10 \(^{16}\) , 4.08 \(\times \) 10 \(^{17}\) , 6.74 \(\times \) 10 \(^{15}\) , 4.72 \(\times \) 10 \(^{15}\) , and \(8.82\times 10^{16}\; \text {cm}^{-3}\) together with their measured abundance by about 2.31%, 78.46%, 1.29%, 0.91%, and 16.96%, respectively. Good consistency can be found in the comparison with other experiments.