For a low circular orbit, Newton's law of universal gravitation gives . Using yields
Thus the Moon and Mars have roughly comparable mean densities: low circular-orbit period measures mean density. Equal periods would mean equal mean densities in this approximation. This does not require their masses or radii to be similar. The orbit altitudes must be small compared with the body radii, and the bodies are being treated as approximately spherical.