A wire has length L and is bent in the shape of semicircle of radius r .
then, length of wire = circumference of semicircle
L = πr => r = L/2π
now, magnetic dipole = magnetic moment × minimum separation between two dipoles
minimum separation between dipoles is 2r = 2L/π
hence, magnetic dipole = M × 2L/π = 2M/π