Subcontests
(9)sequence with powers of primes, a_{j+1} = f (a_j)
Define f(n)=n+1 if n=pk>1 is a power of a prime number, and f(n)=p1k1+...+prkr for natural numbers n=p1k1...prkr (r>1,ki>0). Given m>1, we construct the sequence a0=m,aj+1=f(aj) for j≥0 and denote by g(m) the smallest term in this sequence. For each m>1, determine g(m).