It is well known that the value of the polynomial $(x+1)(x+2) \cdots(x+n)$ is exactly divisible by $n$ for every integer $x$. Given $n$, let $k=k(n)$ be the minimal degree of any monic integral polynomial
$$
f(x)=x^{k}+a_{1} x^{k-1}+\cdots+a_{k}
$$
(with integer coefficients and leading coefficient 1) such that the value of $f(x)$ is exactly divisible by $n$ for every integer $x$.
Find the relationship between $n$ and $k=k(n)$. In particular, find the value of $k$ corresponding to $n=1000000$.

Let's think step by step and output the final answer within \boxed{}.
user