This is essentially the problem of the simple pendulum applied to a current loop. The dipole moment p will want to align itself to an external magnetic field. The torque is:

`tau=m xx B=-iaB sin(theta)=I alpha=I d^2/dt^2 theta`

The small oscillations will be when `sin(theta)~~theta` . Then we have the differential equation:

`-iaB theta=Id^2/dt^2 theta`

`d^2/dt^2 theta+(iaB)/I theta=0`

Let `omega^2=(iaB)/I`

`d^2/dt^2 theta+omega^2 theta=0`

This has a solution of the form:

`theta(t)=theta_0 cos(omega*t+phi)`

Therefore the period os small oscillations is:

`T=1/(f) =1/(omega/(2pi))=(2pi)/omega=2pi sqrt(I/(iaB))`

**Further Reading**