Solution :

If  a1 = 1, 2, 3, 4, 5, or 6 then the sequence is obviously periodic. Since for all natural numbers a and b exceeding 2,   ab ≥ a + b , we have

f(n) ≤ n + 1 for all natural values of n.

Let n > 7 be even. Then f(n) = 2 + p2 + + pr + 1 ≤ 3 + p2 p3 pr ≤ 3 +  < n . Thus, f (f (n)) ≤ n for any n ≥ 7 and therefore any sequence starting with n ≥ 7 is bounded by (n +1) and hence is periodic.