Construct ideals in $\mathbb Z[x]$ with a given least number of generators

This is just an elucidation of the hint given in this MO post.

Let $p$ be a prime. The claim is that the ideal $I_n=(p^n, p^{n-1}x, p^{n-2}x^2,\ldots, px^{n-1}, x^{n})$ cannot be generated by fewer than $n+1$ elements.

Claim. $I_n=(p,x)^n$.

Proof of claim. Induction on $n$: if $n=1$, then $I_1=(p,x)$ and we are done.

Assume the result holds for $n$, and let $I_{n+1}=(p^{n+1},p^{n}x,\ldots,px^{n},x^{n+1})$. Then $$I_{n+1} = I_n(p,x) = (p^n,p^{n-1}x,\ldots,px^{n-1},x^n)(p,x);$$ indeed, elements of the right hand side are sums of the form $$\sum_{i=1}^n a_ib_i$$ where $a_i\in (p^n,p^{n-1}x,\ldots,x^n)$ and $b_i\in (p,x)$ for each $i$. If $a_i = k_0p^n + k_1p^{n-1}x + \cdots + k_{n-1}px^{n-1} + x^ng(x)$ and $b_i = \ell_0p + xh(x)$, then the constant term of $a_ib_i$ is congruent to $0$ modulo $p^{n+1}$; the linear term is congruent to $0$ modulo $p^n$; the quadratic term is congruent to $0$ modulo $p^{n-1}$; etc. so $a_ib_i\in I_{n+1}$ for each $i$, hence the sum is in $I_{n+1}$.

Conversely, any element of $I_{n+1}$ can be written as $$b_0p^{n+1}+b_1p^nx + \cdots + b_npx^{n} + x^{n+1}g(x).$$ Since $b_ip^{n+1-i}x^i = (b_ip^{n-i}x^i)p \in (p^n,p^{n-1}x,\ldots,x^n)(p,x)$, each of the first $n+1$ summands lie in the product; and $x^{n+1}g(x) = (x^ng(x))x$, which also lies in the product. Thus, $I_{n+1}$ is contained in the product, giving equality.

By the Induction Hypothesis, $$I_{n+1} = (p^n,p^{n-1}x,\ldots,px^{n-1},x^n)(p,x)= I_n(p,x) = (p,x)^n(p,x) = (p,x)^{n+1}.$$ This proves the claim. $\Box$

Now consider $I_{n}/I_{n+1} = (p,x)^n/(p,x)^{n+1}$. This makes sense, since in general $IJ\subseteq I\cap J\subseteq I$, so $I_{n+1}$ is contained in $I$.

Consider the generators: $p^n\in I_n$ maps to an element of order dividing $p$ in the quotient (since $p^{n+1} = pp^n\in (p,x)^{n+1}$); $p^nx$ likewise maps to an element of order $p$; and so on; every generator of $I_n$ is of order dividing $p$ in the quotient. That means that, as an abelian group, $I_n/I_{n+1}$ is of exponent $p$.

Since we have a finitely generated abelian group of exponent $p$, it is isomorphic, as an abelian group, to a direct sum of copies of the cyclic group of order $p$. The number of cyclic summands is equal to the dimension of $I_n/I_{n+1}$ as a vector space over $\mathbb{F}_p$, the field with $p$ elements.

I claim that the images of the generating set of $I_n$ are linearly independent in $I_n/I_{n+1}$. Indeed, suppose that $\alpha_0,\ldots,\alpha_n\in\mathbb{F}_p$ are such that $$\alpha_0[p^n] + \alpha_1[p^{n-1}x] + \cdots + \alpha_n[x^n] = [0],$$ where $[r]$ denotes the image of $r\in I_n$ in the quotient. Replacing $\alpha_i$ with an integer, $0\leq \alpha_i\lt p$, this amounts to saying that $$\alpha_0p^n + \alpha_1p^{n-1}x + \cdots + \alpha_nx^n \in I_{n+1}.$$ In order for this polynomial to lie in $I_{n+1}$, we need $p^{n+1}|\alpha_0p^n$, $p^n|\alpha_1p^{n-1},\ldots,p|\alpha_n$. Since $\alpha\neq 0$ implies $(p,\alpha_i)=1$ by construction, this is only possible if $\alpha_i=0$ for each $i$. Thus, the images of the generators of $I_n$ are linearly independent in $I_n/I_{n+1}$.

Therefore, $\dim_{\mathbb{F}_p}(I_n/I_{n+1})\geq n+1$. Since the dimension is less than or equal to the size of any generating set for $I_n$, it follows that if $I_n$ can be generated by $m$ elements, then $m\geq n+1$; since we know $I_n$ can be generated by $n+1$ elements, it follows that the minimum size of a generating set for $I_n$ is $n+1$, as desired.