For the case where n is prime, it's easy to see that the only solution you will get is p = 0 which is not possible. For the case where n is not a prime, it can be broken down into a bunch of primes. That part requires a bit of thinking and euler's product formula.