Answer:
Magnesium carbide, MgC2, is a binary compound formed from the elements magnesium and carbon. It can be synthesized by reacting magnesium metal with gaseous acetylene (C2H2) at high temperatures. The resulting product is a gray, crystalline solid that is relatively hard and has a high melting point.
It is not possible for magnesium to form a compound with the formula Mg4C2, because this would require the magnesium atom to have an oxidation state of +4, which is not possible for magnesium. Magnesium typically has an oxidation state of +2 in its compounds, so the most likely formula for a magnesium-carbon compound would be Mg2C. However, this compound does not appear to be stable under normal conditions and is not well-known.