4. for which natural numbers $n$ exists a polynomial $P(x)$ with integer coefficients such that $P(d)=(n / d)^{2}$ holds for all positive divisors $d$ of $n$ ?

## 1st solution
Such a polynomial exists exactly when $n$ is prime, $n=1$ or $n=6$. In the first case, $P(x)=-(n+1) x+\left(n^{2}+n+1\right)$ performs the desired function, for $n=1$ the polynomial $P(x)=1$ and for $n=6$ the polynomial $P(x)=-2 x^{3}+23 x^{2}-82 x+97$.

We now show that these are the only possible values of $n$ and can assume $n>1$. Assume that $n$ is divisible by the square of a prime number $p$. Write $n=p^{k} m$ with $k \geq 2$ and $p \nmid m$, then the following applies

$$
p\left|p^{k}-p^{k-1}\right| P\left(p^{k}\right)-P\left(p^{k-1}\right)=m^{2}-(p m)^{2}=m^{2}\left(1-p^{2}\right)
$$

But this cannot be, because $p$ does not divide the right-hand side. Assume that $n$ is not prime and $p$ is the largest prime divisor of $n$. For each prime divisor $q \neq p$ write $n=p q m$ and obtain

$$
p(q-1)=p q-p \mid P(p q)-P(p)=m^{2}-(q m)^{2}=m^{2}\left(1-q^{2}\right)
$$

therefore $p \mid q+1$ since $m$ is not divisible by $p$. Because $p>q$, $p=q+1$ and therefore $p=3, q=2$. However, since $q$ was arbitrary, $n=6$ must apply.

## 2nd solution

We can again assume $n>1$. Let $1=d_{1}1$ and show that $n$ is prime or $n=6$. The polynomial $x^{2} P(x)-n^{2}$ has all positive divisors of $n$ as zeros. Therefore, there is a polynomial $Q(x)=a_{k} x^{k}+\ldots+a_{1} x+a_{0}$ with whole coefficients and

$$
x^{2} P(x)-n^{2}=Q(x) \prod_{d \mid n}(d-x)
$$

A comparison of the constant and linear coefficients on both sides results in the equations

$$
n^{2}=-a_{0} \prod_{d \mid n} d, \quad a_{1}=a_{0} \sum_{d \mid n} \frac{1}{d}
$$

It follows from the first that $n$ has at most four positive divisors, otherwise the right-hand side would be a real multiple of $n^{2}$. We now assume that $n$ is not prime and distinguish between two cases.

- $n$ has exactly three divisors. Then $n=p^{2}$ with a prime number $p$. The first of the above equations then yields $a_{0}=-p$, but this leads to a contradiction with the second equation that $a_{1}$ cannot be whole.
- $n$ has exactly four divisors $1<p<q<n$ (then $p$ is prime and $q$ is either also prime or the square of $p$ ). It follows from the first equation that $a_{0}=-1$ and from the second that $\left(1+\frac{1}{p}\right)\left(1+\frac{1}{q}\right)$ must be whole. Because $1<p<q$ this is only the case for $p=2, q=3$. Therefore $n=6$.