Calculation of atomic number states: A Bethe ansatz approach