Now constructs solution via primes and exponents.