Use two loops, one following the other, to express a number as a power of 2 times a power of 3 times something not divisible by either 2 or 3.

How would i go about setting up two loops to affect the same problem?