Suppose $P(x)$ is a monic polynomial of degree 2023 such that \[ P(k)=k^{2023} P\left(1-\frac{1}{k}\right) \] for every positive integer $1 \leq k \leq 2023$. Then $P(-1)=\frac{a}{b}$, where $a$ and $b$ relatively prime integers. Compute the unique integer $0 \leq n<2027$ such that $b n-a$ is divisible by the prime 2027 .
Solution: Let $n=2023$. If $P(x)=x^{n}+a_{n-1} x^{n-1}+\cdots+a_{0}$, then let \[ R(x)=x^{n} P\left(1-\frac{1}{x}\right)=(x-1)^{n}+a_{n-1}(x-1)^{n} x+\cdots+a_{0} x^{n} \] Then, note that $Q(x)=P(x)-R(x)$ is a polynomial of degree at most $n$, and it has roots $1,2, \ldots, n$, so we have $Q(x)=k(x-1) \cdots(x-n)$ for some real constant $k$. Now we determine $P(x)$ in terms of $Q(x)$. If $g(x)=1-1 / x$, then $g(g(x))=\frac{1}{1-x}$ and $g(g(g(x)))=x$. Therefore, we have \[ \begin{aligned} P(x)-x^{n} P\left(1-\frac{1}{x}\right) & =Q(x) \\ P\left(1-\frac{1}{x}\right)-\left(1-\frac{1}{x}\right)^{n} P\left(\frac{1}{1-x}\right) & =Q\left(1-\frac{1}{x}\right) \\ P\left(\frac{1}{1-x}\right)-\left(\frac{1}{1-x}\right)^{n} P(x) & =Q\left(\frac{1}{1-x}\right) \end{aligned} \] Adding the first equation, $x^{n}$ times the second, and $(x-1)^{n}$ times the third yields \[ 2 P(x)=Q(x)+x^{n} Q\left(\frac{x-1}{x}\right)+(x-1)^{n} Q\left(\frac{1}{1-x}\right) \] so \[ \begin{aligned} P(x)=\frac{k}{2}((x-1)(x-2) \cdots(x-n)+(0 x-1)(-1 x & -1) \cdots(-(n-1) x-1) \\ & +(-1 x+0)(-2 x+1) \cdots(-n x+(n-1))) \end{aligned} \] Therefore, \[ P(-1)=\frac{k}{2}(-(n+1) !+0+(2 n+1) ! !) \] Also, since $P$ is monic, we know that \[ 1=\frac{k}{2}(1+0-n !) \] so \[ P(-1)=\frac{(2 n-1) ! !-(n+1) !}{1-n !} \] Modulo 2027, $(n+1) !=2026 ! /(2026 \cdot 2025) \equiv-1 /(-1 \cdot-2) \equiv-1 / 2$ and $n !=(n+1) ! / 2024 \equiv 1 / 6$. Also, $(2 n+1) ! ! \equiv 0$. So our answer is \[ \frac{1 / 2}{1-1 / 6}=\frac{3}{5} \equiv \frac{2030}{5}=406 \] $\fbox{406}$.