Answer
The compound has the formula $Mg_3N_2$
Work Step by Step
Magnesium has 2 valence electrons, and Nitrogen has 5 valence electrons. To form a compound, $Mg$ loses 2 electrons and $N$ gains 3 electrons. So, 3 ions of $Mg^{2+}$ combine with 2 ions of $N^{3-}$ to form the neutral compound $Mg_3N_2$. The Lewis structures are shown in the attached image.