4

Short version: What is $$\min_{f: f(x)=0 \iff n|x} |\{f(x) \bmod n: x \in \mathbb{Z}\}|$$ where $f$ is a polynomial over $\mathbb{Z}$ (or equivalently $\mathbb{Z}/n\mathbb{Z}$)?


For example, for $n = 15$, the polynomial $f(x) = x^4$ takes only four possible values $ \bmod {15}$ (namely: $0, 1, 6, 10$), and we can test whether $x$ is divisible by $15$ by checking whether $x^4 \equiv 0 \pmod {15}$.


As a motivating example, consider the following. For a prime number $n$, consider the polynomial $f(x) = x^{n-1}$. Modulo $n$, this maps $0$ to $0$ and any nonzero number to $1$ (by Fermat's little theorem). So $f(x)$ has only two residue classes mod $n$, and moreover looking at which of these two values $f(x) \bmod n$ takes is enough to say whether or not $x$ is divisible by $n$. So we can say that this $f$ "separates" $0$ (from the other residues), and for this $f$, the set of all possible residues has size just $2$.

When $n$ is not prime, things are less straightforward, though they sometimes work out nicely:

  • Modulo $n = 4$, consider the polynomial $f(x) = x^3 + x$. This takes $0$ to $0$ and all other values to $2$.

  • Modulo $n = 8$, the best we can do is still the same polynomial $f(x) = x^3 + x$, taking $0$ to $0$ and other residues to one of $0, 2, 4, 6$.

  • Modulo $n = 9$, the best we can do is the polynomial $x^5 + x^3 + x$, taking the three values $0, 3, 6$.

This motivates the following definitions.

  • Define a discriminating polynomial $f(x)$ as one for which $f(x) \equiv f(0) \pmod n \iff x \equiv 0 \pmod n$. In other words, $f$ separates $0$ from nonzero mod $n$. Clearly, adding a constant does not change whether a polynomial is discriminating so we can assume w.l.o.g that $f(0) = 0$ and $f(x) ≠ 0$ if $x ≠ 0$.

  • Define a minimally discriminating polynomial as a discriminating polynomial for which the set $\{f(x) \bmod n | x \in \mathbb{Z}\}$, i.e. the set of all residues attained by the polynomial, has the smallest size. Call the size of this set $S(n)$.

So the question is: what is $S(n)$, for a given value of $n$?


Some things I've tried:

  • When $n$ is prime, the answer is $S(n) = 2$, as we saw above.

  • When $n = ab$ is the product of two relatively prime numbers (i.e. $\gcd(a, b) = 1$), then $S(n) = S(a)S(b)$. (We can prove this by showing that it's both a lower bound and an upper bound, using the Chinese remainder theorem.)

  • This means that $S$ is a multiplicative function, so it is enough to determine the values of $S$ at prime powers.

  • By a previous answer, I know how to enumerate all the polynomial functions mod $n$ without repetition, so I tried to find the results with a program. Unfortunately the number of polynomial functions can grow quite large, so I was only able to determine the following values:

    • [As mentioned above] For prime $p$, taking $f(x) = x^{p-1}$ gives $S(p) = 2$.
    • For $n = 4$, taking $f(x) = x^3 + x$ gives $S(4) = 2$.
    • For $n = 8$ and $n = 16$, still the same $f$ is optimal, but gives $S(8) = 4$ and $S(16) = 8$. I'm willing to believe at this point that $S(2^n) = 2^{n-1}$.
    • For $n = 9$, taking $x^5 + x^3 + x$ gives $S(9) = 3$.
  • So from these values, we know $S(n)$ for all $n$ from $2$ to $24$: the sequence is $2, 2, 2, 2, 4, 2, 4, 3, 4, 2, 4, 2, 4, 4, 8, 2, 6, 4, 4, 4, 2, 8$ which does not match anything in OEIS. I also tried subtracting $1$ (counting only the nonzero residues), but $1, 1, 1, 1, 3, 1, 3, 2, 3, 1, 3, 1, 3, 3, 7, 1, 5, 3, 3, 3, 1, 7$ is not on OEIS either.

In any case, the remaining question is to calculate $S(p^k)$ for prime $p$ and integer exponent $k \ge 2$.

ShreevatsaR
  • 41,374
  • I had no memory of the actual motivation for this possibly strange-looking question, but I did some digging in my "archives": it was this post called Euler's FizzBuzz (about which I'd left a comment) — the idea is that just as looking at $x^4 \pmod {15}$ tells us whether $x$ is divisible by $15$, what can we do for general $n$ in place of $15$? Or something like that… – ShreevatsaR Jan 20 '22 at 15:57

1 Answers1

2

$S(p^k)=p^{k-1}$ for $k\geq2$.

Proof: Let $f$ be a polynomial satisfying the condition. Wlog $f(0)\equiv 0\pmod{p^k}$. Also $f'(0)\not\equiv 0\pmod p$ as otherwise there would be multiple values mapping to $0$ (e.g. $p^{k-1}$). But then by Hensel's lemma, $f(x)\equiv a\pmod{p^n}$ has a solution for all $a\equiv 0\pmod p$, so at least $p^{k-1}$ different values are attained.

For the other direction and $p\neq 2$, consider the polynomial $f(x)=x(1+x^{p-1}+x^{2(p-1)}+\cdots+x^{(p-1)(p-1)})$. Since its value is always divisible by $p$, it attains at most $p^{k-1}$ values mod $p^k$. For $x\equiv 0\pmod p$, we have $f(x)\equiv 0\pmod p$ and $f'(x)\equiv 1\pmod p$, so Hensel's lemma again gives a unique root lying above $0\pmod p$. We also need to show it has no roots elsewhere: for $x\not\equiv 0\pmod p$, I claim that $p^2\nmid 1+x^{p-1}+x^{2(p-1)}+\cdots+x^{(p-1)(p-1)}=\frac{x^{p(p-1)}-1}{x^{p-1}-1}$. Then we're done, as $f(x)\not\equiv0\pmod{p^2}$. Proving that claim is a standard exercise (and where $p\neq 2$ is required), for example:

Write $x^{p-1}=1+ap^r$ with $p\nmid a$ (and so $r\geq 1$), then $x^{p(p-1)}=(1+ap^r)^p=1+p(ap^r)+\binom{p}{2}(ap^r)^2+\cdots\equiv1+ap^{r+1}+a^2\binom{p}{2}p^{2r}\pmod{p^{2r+1}}$. For $p\neq 2$, $p\mid\binom{p}{2}$, so $x^{p(p-1)}\equiv 1+ap^{r+1}\pmod{p^{2r+1}}$. Hence $\frac{x^{p(p-1)}-1}{x^{p-1}-1}=\frac{ap^{r+1}+bp^{2r+1}}{ap^r}=ap+bp^{r+1}\equiv ap\pmod{p^2}$.

For $p=2$, use $f(x)=x+x^3$. The proof is the same, but uses $4\nmid1+x^2$ at the appropriate point.

ndkrempel
  • 348
  • Wow, thank you very much! I wasn't expecting an answer to this question after all this while; I'll have to read this carefully to understand, but thank you! In the meantime I'll add a bounty to this question, to attract more eyes to it. – ShreevatsaR Jan 20 '22 at 15:58
  • Read and understood, very clear, thanks again! – ShreevatsaR Jan 20 '22 at 22:26