Skip to main content
edited tags
Link
Source Link

Generating polynomials with conditions on coefficients

I want to define polynomials with coefficients given in some range.

Namely, let $p$ be a prime number and $n$ be a positive integer. For all positive integer $k\leq n$ I want to generate all polynomials of degree $k$ with integer coefficients

$$a[0]+a[1]x+...+a[k]x^k$$

such that $a[k]=1$, $a[0]\neq0$ and $0\leq a[i]\leq p-1$ for $1\leq i\leq k-1$.

How can I do this?