Problem 2 of the Canadian Mathematical Olympiad 2017

Let f be a function from the set of positive integers to itself such that, for every n, the number of positive integer divisors of n is equal to f(f(n)). For example, f(f(6)) = 4 and f(f(25)) = 3.

Prove that if p is prime then f(p) is also prime.

Solution on a separate page