A mixture of barium and silver is to be analyzed. The barium component reacts with acid to generate hydrogen gas, while the silver component does not react. Derive an equation for the percentage of barium in the original mixture as a function of the total number of moles of hydrogen gas generated and the total mass of the mixture.