# subalgebras of a polynomial ring

If $k$ is a field, I know that any subalgebra $A \subset k[x]$ is finitely generated, but I wonder if there is a good algorithm to find a set of generators for $A$. In particular, if $(f) \subset k[x]$ is an ideal then $k \oplus (f)$ is a subalgebra. How does one find a set of generators for this subalgebra in terms of $f$?

-

So the particular question is actually straightforward. If $f$ has degree $n$ then $f, xf, x^2 f, ... x^{n-1} f$ generates $k \oplus (f)$; furthermore, this generating set has minimal cardinality (which is stronger than saying it is minimal in the sense that no generator can be omitted). This is clear from degree considerations; the non-constant polynomials in $k \oplus (f)$ necessarily have degree at least $n$ and two such polynomials can't generate another polynomial of degree lower than $2n$, so we need one generator for each degree $n, n+1, ... 2n-1$, and the above clearly suffices (e.g. by the Euclidean algorithm).
In general, of course, it depends on how you're given $A$. One strategy which seems to work okay in practice (e.g. to compute generators of subalgebras invariant under a group action) is to somehow compute the Hilbert series of the subalgebra you care about and then identify enough generators that you can show the subalgebra spanned by the generators has the same Hilbert series as the whole thing.