For any positive integer $k$, denote the sum of digits of $k$ in its decimal representation by $S(k)$. Find all polynomials $P(x)$ with integer coefficients such that for any positive integer $n \geqslant 2016$, the integer $P(n)$ is positive and  $$ S(P(n))=P(S(n)) $$  Answer.  - $P(x)=c$ where $1 \leqslant c \leqslant 9$ is an integer; or - $P(x)=x$.

Solution: We consider three cases according to the degree of $P$.  - Case 1. $P(x)$ is a constant polynomial.  Let $P(x)=c$ where $c$ is an integer constant. Then (1) becomes $S(c)=c$. This holds if and only if $1 \leqslant c \leqslant 9$.  - Case 2. $\operatorname{deg} P=1$.  We have the following observation. For any positive integers $m, n$, we have  $$ S(m+n) \leqslant S(m)+S(n) $$  and equality holds if and only if there is no carry in the addition $m+n$. Let $P(x)=a x+b$ for some integers $a, b$ where $a \neq 0$. As $P(n)$ is positive for large $n$, we must have $a \geqslant 1$. The condition (1) becomes $S(a n+b)=a S(n)+b$ for all $n \geqslant 2016$. Setting $n=2025$ and $n=2020$ respectively, we get  $$ S(2025 a+b)-S(2020 a+b)=(a S(2025)+b)-(a S(2020)+b)=5 a $$  On the other hand, (2) implies  $$ S(2025 a+b)=S((2020 a+b)+5 a) \leqslant S(2020 a+b)+S(5 a) $$  These give $5 a \leqslant S(5 a)$. As $a \geqslant 1$, this holds only when $a=1$, in which case (1) reduces to $S(n+b)=S(n)+b$ for all $n \geqslant 2016$. Then we find that  $$ S(n+1+b)-S(n+b)=(S(n+1)+b)-(S(n)+b)=S(n+1)-S(n) $$  If $b>0$, we choose $n$ such that $n+1+b=10^{k}$ for some sufficiently large $k$. Note that all the digits of $n+b$ are 9 's, so that the left-hand side of (3) equals $1-9 k$. As $n$ is a positive integer less than $10^{k}-1$, we have $S(n)<9 k$. Therefore, the right-hand side of (3) is at least $1-(9 k-1)=2-9 k$, which is a contradiction.  The case $b<0$ can be handled similarly by considering $n+1$ to be a large power of 10 . Therefore, we conclude that $P(x)=x$, in which case (1) is trivially satisfied.  - Case 3. $\operatorname{deg} P \geqslant 2$.  Suppose the leading term of $P$ is $a_{d} n^{d}$ where $a_{d} \neq 0$. Clearly, we have $a_{d}>0$. Consider $n=10^{k}-1$ in (1). We get $S(P(n))=P(9 k)$. Note that $P(n)$ grows asymptotically as fast as $n^{d}$, so $S(P(n))$ grows asymptotically as no faster than a constant multiple of $k$. On the other hand, $P(9 k)$ grows asymptotically as fast as $k^{d}$. This shows the two sides of the last equation cannot be equal for sufficiently large $k$ since $d \geqslant 2$.  Therefore, we conclude that $P(x)=c$ where $1 \leqslant c \leqslant 9$ is an integer, or $P(x)=x$.


Solution: Let $P(x)=a_{d} x^{d}+a_{d-1} x^{d-1}+\cdots+a_{0}$. Clearly $a_{d}>0$. There exists an integer $m \geqslant 1$ such that $\left|a_{i}\right|<10^{m}$ for all $0 \leqslant i \leqslant d$. Consider $n=9 \times 10^{k}$ for a sufficiently large integer $k$ in (1). If there exists an index $0 \leqslant i \leqslant d-1$ such that $a_{i}<0$, then all digits of $P(n)$ in positions from $10^{i k+m+1}$ to $10^{(i+1) k-1}$ are all 9 's. Hence, we have $S(P(n)) \geqslant 9(k-m-1)$. On the other hand, $P(S(n))=P(9)$ is a fixed constant. Therefore, (1) cannot hold for large $k$. This shows $a_{i} \geqslant 0$ for all $0 \leqslant i \leqslant d-1$.  Hence, $P(n)$ is an integer formed by the nonnegative integers $a_{d} \times 9^{d}, a_{d-1} \times 9^{d-1}, \ldots, a_{0}$ by inserting some zeros in between. This yields  $$ S(P(n))=S\left(a_{d} \times 9^{d}\right)+S\left(a_{d-1} \times 9^{d-1}\right)+\cdots+S\left(a_{0}\right) . $$  Combining with (1), we have  $$ S\left(a_{d} \times 9^{d}\right)+S\left(a_{d-1} \times 9^{d-1}\right)+\cdots+S\left(a_{0}\right)=P(9)=a_{d} \times 9^{d}+a_{d-1} \times 9^{d-1}+\cdots+a_{0} $$  As $S(m) \leqslant m$ for any positive integer $m$, with equality when $1 \leqslant m \leqslant 9$, this forces each $a_{i} \times 9^{i}$ to be a positive integer between 1 and 9 . In particular, this shows $a_{i}=0$ for $i \geqslant 2$ and hence $d \leqslant 1$. Also, we have $a_{1} \leqslant 1$ and $a_{0} \leqslant 9$. If $a_{1}=1$ and $1 \leqslant a_{0} \leqslant 9$, we take $n=10^{k}+\left(10-a_{0}\right)$ for sufficiently large $k$ in (1). This yields a contradiction since  $$ S(P(n))=S\left(10^{k}+10\right)=2 \neq 11=P\left(11-a_{0}\right)=P(S(n)) $$  The zero polynomial is also rejected since $P(n)$ is positive for large $n$. The remaining candidates are $P(x)=x$ or $P(x)=a_{0}$ where $1 \leqslant a_{0} \leqslant 9$, all of which satisfy (1), and hence are the only solutions.


Let $\tau(n)$ be the number of positive divisors of $n$. Let $\tau_{1}(n)$ be the number of positive divisors of $n$ which have remainders 1 when divided by 3 . Find all possible integral values of the fraction $\frac{\tau(10 n)}{\tau_{1}(10 n)}$.  Answer. All composite numbers together with 2.

Solution: In this solution, we always use $p_{i}$ to denote primes congruent to $1 \bmod 3$, and use $q_{j}$ to denote primes congruent to $2 \bmod 3$. When we express a positive integer $m$ using its prime factorization, we also include the special case $m=1$ by allowing the exponents to be zeros. We first compute $\tau_{1}(m)$ for a positive integer $m$.  - Claim. Let $m=3^{x} p_{1}^{a_{1}} p_{2}^{a_{2}} \cdots p_{s}^{a_{s}} q_{1}^{b_{1}} q_{2}^{b_{2}} \cdots q_{t}^{b_{t}}$ be the prime factorization of $m$. Then  $$ \tau_{1}(m)=\prod_{i=1}^{s}\left(a_{i}+1\right)\left\lceil\frac{1}{2} \prod_{j=1}^{t}\left(b_{j}+1\right)\right\rceil . $$  Proof. To choose a divisor of $m$ congruent to $1 \bmod 3$, it cannot have the prime divisor 3, while there is no restriction on choosing prime factors congruent to $1 \bmod 3$. Also, we have to choose an even number of prime factors (counted with multiplicity) congruent to $2 \bmod 3$.  If $\prod_{j=1}^{t}\left(b_{j}+1\right)$ is even, then we may assume without loss of generality $b_{1}+1$ is even. We can choose the prime factors $q_{2}, q_{3}, \ldots, q_{t}$ freely in $\prod_{j=2}^{t}\left(b_{j}+1\right)$ ways. Then the parity of the number of $q_{1}$ is uniquely determined, and hence there are $\frac{1}{2}\left(b_{1}+1\right)$ ways to choose the exponent of $q_{1}$. Hence (1) is verified in this case.  If $\prod_{j=1}^{t}\left(b_{j}+1\right)$ is odd, we use induction on $t$ to count the number of choices. When $t=1$, there are $\left\lceil\frac{b_{1}+1}{2}\right\rceil$ choices for which the exponent is even and $\left\lfloor\frac{b_{1}+1}{2}\right\rfloor$ choices for which the exponent is odd. For the inductive step, we find that there are  $$ \left\lceil\frac{1}{2} \prod_{j=1}^{t-1}\left(b_{j}+1\right)\right\rceil \cdot\left\lceil\frac{b_{t}+1}{2}\right\rceil+\left\lfloor\frac{1}{2} \prod_{j=1}^{t-1}\left(b_{j}+1\right)\right\rfloor \cdot\left\lfloor\frac{b_{t}+1}{2}\right\rfloor=\left\lceil\frac{1}{2} \prod_{j=1}^{t}\left(b_{j}+1\right)\right\rceil $$  choices with an even number of prime factors and hence $\left\lfloor\frac{1}{2} \prod_{j=1}^{t}\left(b_{j}+1\right)\right\rfloor$ choices with an odd number of prime factors. Hence (1) is also true in this case.  Let $n=3^{x} 2^{y} 5^{z} p_{1}^{a_{1}} p_{2}^{a_{2}} \cdots p_{s}^{a_{s}} q_{1}^{b_{1}} q_{2}^{b_{2}} \cdots q_{t}^{b_{t}}$. Using the well-known formula for computing the divisor function, we get  $$ \tau(10 n)=(x+1)(y+2)(z+2) \prod_{i=1}^{s}\left(a_{i}+1\right) \prod_{j=1}^{t}\left(b_{j}+1\right) $$  By the Claim, we have  $$ \tau_{1}(10 n)=\prod_{i=1}^{s}\left(a_{i}+1\right)\left\lceil\frac{1}{2}(y+2)(z+2) \prod_{j=1}^{t}\left(b_{j}+1\right)\right\rceil $$  If $c=(y+2)(z+2) \prod_{j=1}^{t}\left(b_{j}+1\right)$ is even, then (2) and (3) imply  $$ \frac{\tau(10 n)}{\tau_{1}(10 n)}=2(x+1) $$  In this case $\frac{\tau(10 n)}{\tau_{1}(10 n)}$ can be any even positive integer as $x$ runs through all nonnegative integers. If $c$ is odd, which means $y, z$ are odd and each $b_{j}$ is even, then (2) and (3) imply  $$ \frac{\tau(10 n)}{\tau_{1}(10 n)}=\frac{2(x+1) c}{c+1} $$  For this to be an integer, we need $c+1$ divides $2(x+1)$ since $c$ and $c+1$ are relatively prime. Let $2(x+1)=k(c+1)$. Then (4) reduces to  $$ \frac{\tau(10 n)}{\tau_{1}(10 n)}=k c=k(y+2)(z+2) \prod_{j=1}^{t}\left(b_{j}+1\right) $$  Noting that $y, z$ are odd, the integers $y+2$ and $z+2$ are at least 3 . This shows the integer in this case must be composite. On the other hand, for any odd composite number $a b$ with $a, b \geqslant 3$, we may simply take $n=3^{\frac{a b-1}{2}} \cdot 2^{a-2} \cdot 5^{b-2}$ so that $\frac{\tau(10 n)}{\tau_{1}(10 n)}=a b$ from (5).  We conclude that the fraction can be any even integer or any odd composite number. Equivalently, it can be 2 or any composite number.


Define $P(n)=n^{2}+n+1$. For any positive integers $a$ and $b$, the set  $$ \{P(a), P(a+1), P(a+2), \ldots, P(a+b)\} $$  is said to be fragrant if none of its elements is relatively prime to the product of the other elements. Determine the smallest size of a fragrant set.  Answer. 6.

Solution: We have the following observations. (i) $(P(n), P(n+1))=1$ for any $n$.  We have $(P(n), P(n+1))=\left(n^{2}+n+1, n^{2}+3 n+3\right)=\left(n^{2}+n+1,2 n+2\right)$. Noting that $n^{2}+n+1$ is odd and $\left(n^{2}+n+1, n+1\right)=(1, n+1)=1$, the claim follows. (ii) $(P(n), P(n+2))=1$ for $n \not \equiv 2(\bmod 7)$ and $(P(n), P(n+2))=7$ for $n \equiv 2(\bmod 7)$.  From $(2 n+7) P(n)-(2 n-1) P(n+2)=14$ and the fact that $P(n)$ is odd, $(P(n), P(n+2))$ must be a divisor of 7 . The claim follows by checking $n \equiv 0,1, \ldots, 6(\bmod 7)$ directly. (iii) $(P(n), P(n+3))=1$ for $n \not \equiv 1(\bmod 3)$ and $3 \mid(P(n), P(n+3))$ for $n \equiv 1(\bmod 3)$.  From $(n+5) P(n)-(n-1) P(n+3)=18$ and the fact that $P(n)$ is odd, $(P(n), P(n+3))$ must be a divisor of 9 . The claim follows by checking $n \equiv 0,1,2(\bmod 3)$ directly.  Suppose there exists a fragrant set with at most 5 elements. We may assume it contains exactly 5 elements $P(a), P(a+1), \ldots, P(a+4)$ since the following argument also works with fewer elements. Consider $P(a+2)$. From (i), it is relatively prime to $P(a+1)$ and $P(a+3)$. Without loss of generality, assume $(P(a), P(a+2))>1$. From (ii), we have $a \equiv 2(\bmod 7)$. The same observation implies $(P(a+1), P(a+3))=1$. In order that the set is fragrant, $(P(a), P(a+3))$ and $(P(a+1), P(a+4))$ must both be greater than 1. From (iii), this holds only when both $a$ and $a+1$ are congruent to $1 \bmod 3$, which is a contradiction.  It now suffices to construct a fragrant set of size 6. By the Chinese Remainder Theorem, we can take a positive integer $a$ such that  $$ a \equiv 7 \quad(\bmod 19), \quad a+1 \equiv 2 \quad(\bmod 7), \quad a+2 \equiv 1 \quad(\bmod 3) $$  For example, we may take $a=197$. From (ii), both $P(a+1)$ and $P(a+3)$ are divisible by 7. From (iii), both $P(a+2)$ and $P(a+5)$ are divisible by 3 . One also checks from $19 \mid P(7)=57$ and $19 \mid P(11)=133$ that $P(a)$ and $P(a+4)$ are divisible by 19. Therefore, the set $\{P(a), P(a+1), \ldots, P(a+5)\}$ is fragrant.  Therefore, the smallest size of a fragrant set is 6 . Comment. "Fragrant Harbour" is the English translation of "Hong Kong". A stronger version of this problem is to show that there exists a fragrant set of size $k$ for any $k \geqslant 6$. We present a proof here.  For each even positive integer $m$ which is not divisible by 3 , since $m^{2}+3 \equiv 3(\bmod 4)$, we can find a prime $p_{m} \equiv 3(\bmod 4)$ such that $p_{m} \mid m^{2}+3$. Clearly, $p_{m}>3$.  If $b=2 t \geqslant 6$, we choose $a$ such that $3 \mid 2(a+t)+1$ and $p_{m} \mid 2(a+t)+1$ for each $1 \leqslant m \leqslant b$ with $m \equiv 2,4(\bmod 6)$. For $0 \leqslant r \leqslant t$ and $3 \mid r$, we have $a+t \pm r \equiv 1(\bmod 3)$ so that $3 \mid P(a+t \pm r)$. For $0 \leqslant r \leqslant t$ and $(r, 3)=1$, we have  $$ 4 P(a+t \pm r) \equiv(-1 \pm 2 r)^{2}+2(-1 \pm 2 r)+4=4 r^{2}+3 \equiv 0 \quad\left(\bmod p_{2 r}\right) . $$  Hence, $\{P(a), P(a+1), \ldots, P(a+b)\}$ is fragrant. If $b=2 t+1 \geqslant 7$ (the case $b=5$ has been done in the original problem), we choose $a$ such that $3 \mid 2(a+t)+1$ and $p_{m} \mid 2(a+t)+1$ for $1 \leqslant m \leqslant b$ with $m \equiv 2,4(\bmod 6)$, and that $a+b \equiv 9(\bmod 13)$. Note that $a$ exists by the Chinese Remainder Theorem since $p_{m} \neq 13$ for all $m$. The even case shows that $\{P(a), P(a+1), \ldots, P(a+b-1)\}$ is fragrant. Also, one checks from $13 \mid P(9)=91$ and $13 \mid P(3)=13$ that $P(a+b)$ and $P(a+b-6)$ are divisible by 13. The proof is thus complete.


Denote by $\mathbb{N}$ the set of all positive integers. Find all functions $f: \mathbb{N} \rightarrow \mathbb{N}$ such that for all positive integers $m$ and $n$, the integer $f(m)+f(n)-m n$ is nonzero and divides $m f(m)+n f(n)$. Answer. $f(n)=n^{2}$ for any $n \in \mathbb{N}$.

Solution: It is given that  $$ f(m)+f(n)-m n \mid m f(m)+n f(n) $$  Taking $m=n=1$ in (1), we have $2 f(1)-1 \mid 2 f(1)$. Then $2 f(1)-1 \mid 2 f(1)-(2 f(1)-1)=1$ and hence $f(1)=1$.  Let $p \geqslant 7$ be a prime. Taking $m=p$ and $n=1$ in (1), we have $f(p)-p+1 \mid p f(p)+1$ and hence  $$ f(p)-p+1 \mid p f(p)+1-p(f(p)-p+1)=p^{2}-p+1 $$  If $f(p)-p+1=p^{2}-p+1$, then $f(p)=p^{2}$. If $f(p)-p+1 \neq p^{2}-p+1$, as $p^{2}-p+1$ is an odd positive integer, we have $p^{2}-p+1 \geqslant 3(f(p)-p+1)$, that is,  $$ f(p) \leqslant \frac{1}{3}\left(p^{2}+2 p-2\right) $$  Taking $m=n=p$ in (1), we have $2 f(p)-p^{2} \mid 2 p f(p)$. This implies  $$ 2 f(p)-p^{2} \mid 2 p f(p)-p\left(2 f(p)-p^{2}\right)=p^{3} $$  By (2) and $f(p) \geqslant 1$, we get  $$ -p^{2}<2 f(p)-p^{2} \leqslant \frac{2}{3}\left(p^{2}+2 p-2\right)-p^{2}<-p $$  since $p \geqslant 7$. This contradicts the fact that $2 f(p)-p^{2}$ is a factor of $p^{3}$. Thus we have proved that $f(p)=p^{2}$ for all primes $p \geqslant 7$.  Let $n$ be a fixed positive integer. Choose a sufficiently large prime $p$. Consider $m=p$ in (1). We obtain  $$ f(p)+f(n)-p n \mid p f(p)+n f(n)-n(f(p)+f(n)-p n)=p f(p)-n f(p)+p n^{2} $$  As $f(p)=p^{2}$, this implies $p^{2}-p n+f(n) \mid p\left(p^{2}-p n+n^{2}\right)$. As $p$ is sufficiently large and $n$ is fixed, $p$ cannot divide $f(n)$, and so $\left(p, p^{2}-p n+f(n)\right)=1$. It follows that $p^{2}-p n+f(n) \mid p^{2}-p n+n^{2}$ and hence  $$ p^{2}-p n+f(n) \mid\left(p^{2}-p n+n^{2}\right)-\left(p^{2}-p n+f(n)\right)=n^{2}-f(n) $$  Note that $n^{2}-f(n)$ is fixed while $p^{2}-p n+f(n)$ is chosen to be sufficiently large. Therefore, we must have $n^{2}-f(n)=0$ so that $f(n)=n^{2}$ for any positive integer $n$.  Finally, we check that when $f(n)=n^{2}$ for any positive integer $n$, then  $$ f(m)+f(n)-m n=m^{2}+n^{2}-m n $$  and  $$ m f(m)+n f(n)=m^{3}+n^{3}=(m+n)\left(m^{2}+n^{2}-m n\right) $$  The latter expression is divisible by the former for any positive integers $m, n$. This shows $f(n)=n^{2}$ is the only solution.


Let $n$ be an odd positive integer. In the Cartesian plane, a cyclic polygon $P$ with area $S$ is chosen. All its vertices have integral coordinates, and the squares of its side lengths are all divisible by $n$. Prove that $2 S$ is an integer divisible by $n$.

Solution: Let $P=A_{1} A_{2} \ldots A_{k}$ and let $A_{k+i}=A_{i}$ for $i \geqslant 1$. By the Shoelace Formula, the area of any convex polygon with integral coordinates is half an integer. Therefore, $2 S$ is an integer. We shall prove by induction on $k \geqslant 3$ that $2 S$ is divisible by $n$. Clearly, it suffices to consider $n=p^{t}$ where $p$ is an odd prime and $t \geqslant 1$.  For the base case $k=3$, let the side lengths of $P$ be $\sqrt{n a}, \sqrt{n b}, \sqrt{n c}$ where $a, b, c$ are positive integers. By Heron's Formula,  $$ 16 S^{2}=n^{2}\left(2 a b+2 b c+2 c a-a^{2}-b^{2}-c^{2}\right) $$  This shows $16 S^{2}$ is divisible by $n^{2}$. Since $n$ is odd, $2 S$ is divisible by $n$. Assume $k \geqslant 4$. If the square of length of one of the diagonals is divisible by $n$, then that diagonal divides $P$ into two smaller polygons, to which the induction hypothesis applies. Hence we may assume that none of the squares of diagonal lengths is divisible by $n$. As usual, we denote by $\nu_{p}(r)$ the exponent of $p$ in the prime decomposition of $r$. We claim the following.  - Claim. $\nu_{p}\left(A_{1} A_{m}^{2}\right)>\nu_{p}\left(A_{1} A_{m+1}^{2}\right)$ for $2 \leqslant m \leqslant k-1$.  Proof. The case $m=2$ is obvious since $\nu_{p}\left(A_{1} A_{2}^{2}\right) \geqslant p^{t}>\nu_{p}\left(A_{1} A_{3}^{2}\right)$ by the condition and the above assumption.  Suppose $\nu_{p}\left(A_{1} A_{2}^{2}\right)>\nu_{p}\left(A_{1} A_{3}^{2}\right)>\cdots>\nu_{p}\left(A_{1} A_{m}^{2}\right)$ where $3 \leqslant m \leqslant k-1$. For the induction step, we apply Ptolemy's Theorem to the cyclic quadrilateral $A_{1} A_{m-1} A_{m} A_{m+1}$ to get  $$ A_{1} A_{m+1} \times A_{m-1} A_{m}+A_{1} A_{m-1} \times A_{m} A_{m+1}=A_{1} A_{m} \times A_{m-1} A_{m+1} $$  which can be rewritten as  $$ \begin{aligned} A_{1} A_{m+1}^{2} \times A_{m-1} A_{m}^{2}= & A_{1} A_{m-1}^{2} \times A_{m} A_{m+1}^{2}+A_{1} A_{m}^{2} \times A_{m-1} A_{m+1}^{2} \\ & -2 A_{1} A_{m-1} \times A_{m} A_{m+1} \times A_{1} A_{m} \times A_{m-1} A_{m+1} \end{aligned} $$  From this, $2 A_{1} A_{m-1} \times A_{m} A_{m+1} \times A_{1} A_{m} \times A_{m-1} A_{m+1}$ is an integer. We consider the component of $p$ of each term in (1). By the inductive hypothesis, we have $\nu_{p}\left(A_{1} A_{m-1}^{2}\right)>\nu_{p}\left(A_{1} A_{m}^{2}\right)$. Also, we have $\nu_{p}\left(A_{m} A_{m+1}^{2}\right) \geqslant p^{t}>\nu_{p}\left(A_{m-1} A_{m+1}^{2}\right)$. These give  $$ \nu_{p}\left(A_{1} A_{m-1}^{2} \times A_{m} A_{m+1}^{2}\right)>\nu_{p}\left(A_{1} A_{m}^{2} \times A_{m-1} A_{m+1}^{2}\right) $$  Next, we have $\nu_{p}\left(4 A_{1} A_{m-1}^{2} \times A_{m} A_{m+1}^{2} \times A_{1} A_{m}^{2} \times A_{m-1} A_{m+1}^{2}\right)=\nu_{p}\left(A_{1} A_{m-1}^{2} \times A_{m} A_{m+1}^{2}\right)+$ $\nu_{p}\left(A_{1} A_{m}^{2} \times A_{m-1} A_{m+1}^{2}\right)>2 \nu_{p}\left(A_{1} A_{m}^{2} \times A_{m-1} A_{m+1}^{2}\right)$ from (2). This implies  $$ \nu_{p}\left(2 A_{1} A_{m-1} \times A_{m} A_{m+1} \times A_{1} A_{m} \times A_{m-1} A_{m+1}\right)>\nu_{p}\left(A_{1} A_{m}^{2} \times A_{m-1} A_{m+1}^{2}\right) $$  Combining (1), (2) and (3), we conclude that  $$ \nu_{p}\left(A_{1} A_{m+1}^{2} \times A_{m-1} A_{m}^{2}\right)=\nu_{p}\left(A_{1} A_{m}^{2} \times A_{m-1} A_{m+1}^{2}\right) $$  By $\nu_{p}\left(A_{m-1} A_{m}^{2}\right) \geqslant p^{t}>\nu_{p}\left(A_{m-1} A_{m+1}^{2}\right)$, we get $\nu_{p}\left(A_{1} A_{m+1}^{2}\right)<\nu_{p}\left(A_{1} A_{m}^{2}\right)$. The Claim follows by induction.  From the Claim, we get a chain of inequalities  $$ p^{t}>\nu_{p}\left(A_{1} A_{3}^{2}\right)>\nu_{p}\left(A_{1} A_{4}^{2}\right)>\cdots>\nu_{p}\left(A_{1} A_{k}^{2}\right) \geqslant p^{t} $$  which yields a contradiction. Therefore, we can show by induction that $2 S$ is divisible by $n$. Comment. The condition that $P$ is cyclic is crucial. As a counterexample, consider the rhombus with vertices $(0,3),(4,0),(0,-3),(-4,0)$. Each of its squares of side lengths is divisible by 5 , while $2 S=48$ is not.  The proposer also gives a proof for the case $n$ is even. One just needs an extra technical step for the case $p=2$.


Find all polynomials $P(x)$ of odd degree $d$ and with integer coefficients satisfying the following property: for each positive integer $n$, there exist $n$ positive integers $x_{1}, x_{2}, \ldots, x_{n}$ such that $\frac{1}{2}<\frac{P\left(x_{i}\right)}{P\left(x_{j}\right)}<2$ and $\frac{P\left(x_{i}\right)}{P\left(x_{j}\right)}$ is the $d$-th power of a rational number for every pair of indices $i$ and $j$ with $1 \leqslant i, j \leqslant n$.  Answer. $P(x)=a(r x+s)^{d}$ where $a, r, s$ are integers with $a \neq 0, r \geqslant 1$ and $(r, s)=1$.

Solution: Let $P(x)=a_{d} x^{d}+a_{d-1} x^{d-1}+\cdots+a_{0}$. Consider the substitution $y=d a_{d} x+a_{d-1}$. By defining $Q(y)=P(x)$, we find that $Q$ is a polynomial with rational coefficients without the term $y^{d-1}$. Let $Q(y)=b_{d} y^{d}+b_{d-2} y^{d-2}+b_{d-3} y^{d-3}+\cdots+b_{0}$ and $B=\max _{0 \leqslant i \leqslant d}\left\{\left|b_{i}\right|\right\}$ (where $b_{d-1}=0$ ).  The condition shows that for each $n \geqslant 1$, there exist integers $y_{1}, y_{2}, \ldots, y_{n}$ such that $\frac{1}{2}<\frac{Q\left(y_{i}\right)}{Q\left(y_{j}\right)}<2$ and $\frac{Q\left(y_{i}\right)}{Q\left(y_{j}\right)}$ is the $d$-th power of a rational number for $1 \leqslant i, j \leqslant n$. Since $n$ can be arbitrarily large, we may assume all $x_{i}$ 's and hence $y_{i}$ 's are integers larger than some absolute constant in the following.  By Dirichlet's Theorem, since $d$ is odd, we can find a sufficiently large prime $p$ such that $p \equiv 2(\bmod d)$. In particular, we have $(p-1, d)=1$. For this fixed $p$, we choose $n$ to be sufficiently large. Then by the Pigeonhole Principle, there must be $d+1$ of $y_{1}, y_{2}, \ldots, y_{n}$ which are congruent $\bmod p$. Without loss of generality, assume $y_{i} \equiv y_{j}(\bmod p)$ for $1 \leqslant i, j \leqslant d+1$. We shall establish the following.  - Claim. $\frac{Q\left(y_{i}\right)}{Q\left(y_{1}\right)}=\frac{y_{i}^{d}}{y_{1}^{d}}$ for $2 \leqslant i \leqslant d+1$.  Proof. Let $\frac{Q\left(y_{i}\right)}{Q\left(y_{1}\right)}=\frac{l^{d}}{m^{d}}$ where $(l, m)=1$ and $l, m>0$. This can be rewritten in the expanded form  $$ b_{d}\left(m^{d} y_{i}^{d}-l^{d} y_{1}^{d}\right)=-\sum_{j=0}^{d-2} b_{j}\left(m^{d} y_{i}^{j}-l^{d} y_{1}^{j}\right) $$  Let $c$ be the common denominator of $Q$, so that $c Q(k)$ is an integer for any integer $k$. Note that $c$ depends only on $P$ and so we may assume $(p, c)=1$. Then $y_{1} \equiv y_{i}(\bmod p)$ implies $c Q\left(y_{1}\right) \equiv c Q\left(y_{i}\right)(\bmod p)$.  - Case 1. $p \mid c Q\left(y_{1}\right)$.  In this case, there is a cancellation of $p$ in the numerator and denominator of $\frac{c Q\left(y_{i}\right)}{c Q\left(y_{1}\right)}$, so that $m^{d} \leqslant p^{-1}\left|c Q\left(y_{1}\right)\right|$. Noting $\left|Q\left(y_{1}\right)\right|<2 B y_{1}^{d}$ as $y_{1}$ is large, we get  $$ m \leqslant p^{-\frac{1}{d}}(2 c B)^{\frac{1}{d}} y_{1} $$  For large $y_{1}$ and $y_{i}$, the relation $\frac{1}{2}<\frac{Q\left(y_{i}\right)}{Q\left(y_{1}\right)}<2$ implies  $$ \frac{1}{3}<\frac{y_{i}^{d}}{y_{1}^{d}}<3 $$  We also have  $$ \frac{1}{2}<\frac{l^{d}}{m^{d}}<2 $$  Now, the left-hand side of (1) is  $$ b_{d}\left(m y_{i}-l y_{1}\right)\left(m^{d-1} y_{i}^{d-1}+m^{d-2} y_{i}^{d-2} l y_{1}+\cdots+l^{d-1} y_{1}^{d-1}\right) . $$  Suppose on the contrary that $m y_{i}-l y_{1} \neq 0$. Then the absolute value of the above expression is at least $\left|b_{d}\right| m^{d-1} y_{i}^{d-1}$. On the other hand, the absolute value of the right-hand side of (1) is at most  $$ \begin{aligned} \sum_{j=0}^{d-2} B\left(m^{d} y_{i}^{j}+l^{d} y_{1}^{j}\right) & \leqslant(d-1) B\left(m^{d} y_{i}^{d-2}+l^{d} y_{1}^{d-2}\right) \\ & \leqslant(d-1) B\left(7 m^{d} y_{i}^{d-2}\right) \\ & \leqslant 7(d-1) B\left(p^{-\frac{1}{d}}(2 c B)^{\frac{1}{d}} y_{1}\right) m^{d-1} y_{i}^{d-2} \\ & \leqslant 21(d-1) B p^{-\frac{1}{d}}(2 c B)^{\frac{1}{d}} m^{d-1} y_{i}^{d-1} \end{aligned} $$  by using successively (3), (4), (2) and again (3). This shows  $$ \left|b_{d}\right| m^{d-1} y_{i}^{d-1} \leqslant 21(d-1) B p^{-\frac{1}{d}}(2 c B)^{\frac{1}{d}} m^{d-1} y_{i}^{d-1}, $$  which is a contradiction for large $p$ as $b_{d}, B, c, d$ depend only on the polynomial $P$. Therefore, we have $m y_{i}-l y_{1}=0$ in this case.  - Case 2. $\left(p, c Q\left(y_{1}\right)\right)=1$.  From $c Q\left(y_{1}\right) \equiv c Q\left(y_{i}\right)(\bmod p)$, we have $l^{d} \equiv m^{d}(\bmod p)$. Since $(p-1, d)=1$, we use Fermat Little Theorem to conclude $l \equiv m(\bmod p)$. Then $p \mid m y_{i}-l y_{1}$. Suppose on the contrary that $m y_{i}-l y_{1} \neq 0$. Then the left-hand side of (1) has absolute value at least $\left|b_{d}\right| p m^{d-1} y_{i}^{d-1}$. Similar to Case 1, the right-hand side of (1) has absolute value at most  $$ 21(d-1) B(2 c B)^{\frac{1}{d}} m^{d-1} y_{i}^{d-1} $$  which must be smaller than $\left|b_{d}\right| p m^{d-1} y_{i}^{d-1}$ for large $p$. Again this yields a contradiction and hence $m y_{i}-l y_{1}=0$.  In both cases, we find that $\frac{Q\left(y_{i}\right)}{Q\left(y_{1}\right)}=\frac{l^{d}}{m^{d}}=\frac{y_{i}^{d}}{y_{1}^{d}}$. From the Claim, the polynomial $Q\left(y_{1}\right) y^{d}-y_{1}^{d} Q(y)$ has roots $y=y_{1}, y_{2}, \ldots, y_{d+1}$. Since its degree is at most $d$, this must be the zero polynomial. Hence, $Q(y)=b_{d} y^{d}$. This implies $P(x)=a_{d}\left(x+\frac{a_{d-1}}{d a_{d}}\right)^{d}$. Let $\frac{a_{d-1}}{d a_{d}}=\frac{s}{r}$ with integers $r, s$ where $r \geqslant 1$ and $(r, s)=1$. Since $P$ has integer coefficients, we need $r^{d} \mid a_{d}$. Let $a_{d}=r^{d} a$. Then $P(x)=a(r x+s)^{d}$. It is obvious that such a polynomial satisfies the conditions.  Comment. In the proof, the use of prime and Dirichlet's Theorem can be avoided. One can easily show that each $P\left(x_{i}\right)$ can be expressed in the form $u v_{i}^{d}$ where $u, v_{i}$ are integers and $u$ cannot be divisible by the $d$-th power of a prime (note that $u$ depends only on $P$ ). By fixing a large integer $q$ and by choosing a large $n$, we can apply the Pigeonhole Principle and assume $x_{1} \equiv x_{2} \equiv \cdots \equiv x_{d+1}(\bmod q)$ and $v_{1} \equiv v_{2} \equiv \cdots \equiv v_{d+1}(\bmod q)$. Then the remaining proof is similar to Case 2 of the Solution.  Alternatively, we give another modification of the proof as follows. We take a sufficiently large $n$ and consider the corresponding positive integers $y_{1}, y_{2}, \ldots, y_{n}$. For each $2 \leqslant i \leqslant n$, let $\frac{Q\left(y_{i}\right)}{Q\left(y_{1}\right)}=\frac{l_{i}^{d}}{m_{i}^{d}}$.  As in Case 1, if there are $d$ indices $i$ such that the integers $\frac{c\left|Q\left(y_{1}\right)\right|}{m_{i}^{d}}$ are bounded below by a constant depending only on $P$, we can establish the Claim using those $y_{i}$ 's and complete the proof. Similarly, as in Case 2, if there are $d$ indices $i$ such that the integers $\left|m_{i} y_{i}-l_{i} y_{1}\right|$ are bounded below, then the proof goes the same. So it suffices to consider the case where $\frac{c\left|Q\left(y_{1}\right)\right|}{m_{i}^{d}} \leqslant M$ and $\left|m_{i} y_{i}-l_{i} y_{1}\right| \leqslant N$ for all $2 \leqslant i \leqslant n^{\prime}$ where $M, N$ are fixed constants and $n^{\prime}$ is large. Since there are only finitely many choices for $m_{i}$ and $m_{i} y_{i}-l_{i} y_{1}$, by the Pigeonhole Principle, we can assume without loss of generality $m_{i}=m$ and $m_{i} y_{i}-l_{i} y_{1}=t$ for $2 \leqslant i \leqslant d+2$. Then  $$ \frac{Q\left(y_{i}\right)}{Q\left(y_{1}\right)}=\frac{l_{i}^{d}}{m^{d}}=\frac{\left(m y_{i}-t\right)^{d}}{m^{d} y_{1}^{d}} $$  so that $Q\left(y_{1}\right)(m y-t)^{d}-m^{d} y_{1}^{d} Q(y)$ has roots $y=y_{2}, y_{3}, \ldots, y_{d+2}$. Its degree is at most $d$ and hence it is the zero polynomial. Therefore, $Q(y)=\frac{b_{d}}{m^{d}}(m y-t)^{d}$. Indeed, $Q$ does not have the term $y^{d-1}$, which means $t$ should be 0 . This gives the corresponding $P(x)$ of the desired form.  The two modifications of the Solution work equally well when the degree $d$ is even.