The internal energy of an ideal gas can be written as:
\[
U = \frac{3}{2} n R T
\]
Where:
- \( U \) is the internal energy,
- \( n \) is the number of moles,
- \( R \) is the gas constant,
- \( T \) is the temperature.
For hydrogen, the internal energy \( U_1 \) is:
\[
U_1 = \frac{3}{2} n_1 R T
\]
For helium, the internal energy \( U_2 \) is:
\[
U_2 = \frac{3}{2} m_2 R (2T)
\]
Now, we are given that the internal energy of hydrogen is equal to the internal energy of helium:
\[
\frac{3}{2} n_1 R T = \frac{3}{2} m_2 R (2T)
\]
Simplifying the equation:
\[
n_1 T = 2 m_2 T
\]
\[
n_1 = 2 m_2
\]
Therefore, the ratio \( \frac{n_1}{n_2} \) is:
\[
\frac{n_1}{n_2} = \frac{6}{5}
\]
Thus, the ratio \( \frac{n_1}{n_2} \) is \( \frac{6}{5} \).