
Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Every time you replace n, it will become smaller until it is a prime number, where it will keep the same value each time you replace it.
n decreases logarithmically, allowing you to simulate the process.
To find the prime factors, iterate through all numbers less than n from least to greatest and find the maximum number of times each number divides n.