IMC 2017 · Problem 3

Day 124th IMC · Blagoevgrad, Bulgaria

Statement

For any positive integer mm, denote by P(m)P(m) the product of positive divisors of mm (e.g. P(6)=36P(6) = 36). For every positive integer nn define the sequence

a1(n)=n,ak+1(n)=P(ak(n))(k=1,2,,2016).a_1(n) = n, \qquad a_{k+1}(n) = P(a_k(n)) \quad (k = 1, 2, \ldots, 2016).

Determine whether for every set S{1,2,,2017}S \subseteq \{1, 2, \ldots, 2017\}, there exists a positive integer nn such that the following condition is satisfied:

For every kk with 1k20171 \le k \le 2017, the number ak(n)a_k(n) is a perfect square if and only if kSk \in S.

Official solution

Hidden so you can work on the problem first.

Proposed by Matko Ljulj , University of Zagreb.