It comes as a surprise to many that the orbit of the moon around the sun has no loops in it. Indeed, it is a convex curve not very different from the orbit of Earth around the sun.

How far away from Earth would our moon have to be for the moon's orbit around the sun to have a loop? How far away for it to be nonconvex?

Assume all orbits are circular and all lie in the same plane (so that "loop" and "convex" have clear planar meanings), the Earth-sun distance is 93 million miles, the Earth's orbit requires 365 days, and the moon's orbit around Earth takes 27 days (and that is constant in this problem). Using such approximations has negligible impact on the problem.

Note that the moon's orbit is "prograde": in the same direction as Earth moves around the sun. Both motions are counterclockwise, viewed from our north pole.