Given an integer d, is there a way of finding max(n^m), where d=n*m, except brute-forcing it ? n and m don't have to be primes.

For example:

The number 12 can be factorized into two factors as: 1*12, 2*6, 3*4, 4*3, 6*2 and 12*1. Raising the first factor to the second gives: 1, 64, 81, 64, 36 and 12. The maximum value is 81.