8

Motivation: It is easy to notice that a polynomial map $f: \mathbb{Z} \to \mathbb{Z}$ does not need to have only integer coefficient. For example, $f(x) = \frac{x(x-1)}{2}$ does have rational coefficients and maps $ \mathbb{Z}$ to $\mathbb{Z}$. This gives an easy reason for an polynomial with integer coefficients not to give all possible remainders modulo some number $m$: for instance, $x^2 - x = 2\frac{x(x-1)}{2}$ is always $0$ modulo $2$, and in a similar spirit $f(x) = x^2$ is always $0$ or $1$ modulo $4$. More generally, one can show that a polynomial map $f: \mathbb{Z} \to \mathbb{Z}$ is a $\mathbb{Z}$-linear combination of the polynomials $\binom{x}{d}$ for $d \in \mathbb{N}$.

I am looking for a class of polynomials $f: \mathbb{Z} \to \mathbb{Z}$ which have the property that for any $m \in \mathbb N$ and any remainder $r \in \{0,1,\dots,m-1\}$ there exists some $a \in \mathbb N$ such that $f(a) \equiv r \pmod{m}$. The above shows that $f(n) = n^d$ do not have much chance of working, but $f(n) = \binom{n}{d}$ might.

Question: Is it true that for any $d \in \mathbb N$ and for any $m,r \in \mathbb N, r < m$, the map $f(n) = \binom{n}{d}$ has the property that $f(a) \equiv r \pmod{m}$ for some $a \in \mathbb{Z}$ ?

3 Answers3

4

The answer is no. Take for instance $d = 2, m = 5, r = 4$. More generally, for any $d$, you can find infinitely many values $m$, for which at least $d-1$ values $r$ with $0 \le r < m$ have no solution to $\binom{x}{d} \equiv r \pmod m$. More details follow.

For $d = 0$, the answer is trivially no: $f(x) = \binom{x}{0} = 1$ for all $x$, so we can't have a solution to $f(x) \equiv r \pmod m$ when $r \not\equiv 1 \pmod m$.

For $d=1$, the answer is trivially yes: $f(x) = \binom{x}{1} = x$ for all $x$, so for any $(r,m)$, one solution to $f(x) \equiv r \pmod m$ is to take $x = r$.

For $d\ge 2$ is when it gets interesting. Let's start with $d = 2$. Then $f(x) = \binom{x}{2} = \frac{x(x-1)}{2}$, and we want to know whether the equation $f(x) \equiv r \pmod m$ always has a solution for any $(r,m)$. Looking at the sequence of values $f(x)$, this is OEIS A161680. If you look at its sequence of last digits (corresponding to $m = 10$), you see (‌this is more convenient if you view it as a list) that it is periodic with period $20$, and the only last digits that appear are ${0, 1, 3, 5, 6}$. The other digits ${2, 4, 7, 8, 9}$ never appear. In fact this is easy to prove: for $x \equiv y \pmod {20}$, we have $x(x-1) \equiv y(y-1) \pmod {20}$ which is equivalent to $\dfrac{x(x-1) - y(y-1)}{20}$ being an integer, and thus to $\dfrac{\frac{x(x-1)}2 - \frac{y(y-1)}{2}}{10}$ being an integer, which means that $\frac{x(x-1)}{2} \equiv \frac{y(y-1)}{2} \pmod {10}$. So the sequence is indeed periodic with period $20$. And after this it's just a matter of inspection to see that the only last digits that do occur are as above.

In general, by the same reasoning, the sequence $\binom{x}{2} \bmod m$ has $2m$ as a period. (In other words, $x \equiv y \pmod {2m} \implies \binom{x}{2} \equiv \binom{y}{2} \pmod m$.) In particular, taking $m = 5$, we note that the sequence $\binom{x}{2}$ goes as $0, 0, 1, 3, 1, 0, 0, 1, 3, 0, 0\dots$ so it's in fact periodic with period $5$, and the remainders $2$ and $4$ never occur.


Edit: Even more generally, whenever $\gcd(m, d!) = 1$, the sequence $\binom{x}{d} \bmod m$ has $m$ as a period. Proof: if $x \equiv y \pmod m$, then $x-k \equiv y-k \pmod m$ for all $k$, so $$x(x-1)(x-2)\dots(x-d+1) \equiv y(y-1)(y-2)\dots(y-d+1) \pmod m$$ Now as $\gcd(d!, m) = 1$, we can "divide" both sides by $d$. More accurately, $d$ has an inverse modulo $m$, i.e. a number $d'$ such $dd' \equiv 1 \pmod m$, so multiplying both sides of the above equation by $d'$, we get $$\binom{x}{d} \equiv \binom{y}{d} \pmod m.$$

Note that for $x = 0$ and $x = 1$, we have $\binom{x}{d} = 0$, for any $d \ge 2$. This means in particular that not all $m$ values‌ (remainders) in the period (in the list from $\binom{0}{d} \mod m$ to $\binom{m-1}{d} \mod m$) are distinct, so some remainder must be missing. In fact, we have $\binom{x}{d} = 0$ for $0 \le x \le d-1$, so as this remainder $0$ is repeated $d$ times, it means that at least $d-1$ remainders are missing.

This means that for any $d$, if we take any $m$ for which $\gcd(m, d!) = 1$, there are at least $d-1$ values of $r$ for which the equation $\binom{x}{d} \equiv r$ has no solution.

ShreevatsaR
  • 41,374
  • Thanks for the counterexample! It seems that one should indeed verify ones conjectures on small data before going any further. Somewhat embarassingly, I just noticed that for $d=2$, already $m=3$ provides a counterexample (though $m=2^k$ all work, apparently). – Jakub Konieczny Jul 29 '13 at 17:27
  • @Feanor: Yes, I was editing the answer while you were posting that comment, to observe that for any $d$, any $m$ with $\gcd(m, d!) = 1$ gives a counterexample: in particular, for $d=2$, any odd $m$ (and thus any $m$ with an "odd part", i.e. any $m$ that is not a power of $2$) gives a counterexample. – ShreevatsaR Jul 29 '13 at 17:39
3

The simplest counterexample I can come up with is $m=p$, $d=p-1$, $p$ prime.

When we write $n$ and $k$ in base $p$ as $$ n=\sum_{i\ge0}n_ip^i,\qquad k=\sum_{i\ge0}k_ip^i $$ with $0\le k_i, n_i<p$ for all $i$, we have the well known congruence $$ {n\choose k}\equiv\prod_{i\ge0}{n_i\choose k_i}\pmod p, $$ where ${n_i\choose k_i}$ is interpreted as zero, if $k_i>n_i$.

With $k=p-1$ this gives $$ {n\choose p-1}\equiv{n_0\choose p-1}\prod_{i\ge1}{n_i\choose 0}={n_0\choose p-1}. $$ This is non-zero only if $n_0=p-1$ in which case it is $1$. Therefore whenever $p>2$ the residues $2,3,\ldots,p-1\pmod p$ never occur.

Jyrki Lahtonen
  • 133,153
  • A very sophisticated answer. Given the counterexample above, this is apparently not the simplest solution possible, but it strikes me as very elegant. Many thanks! – Jakub Konieczny Jul 29 '13 at 17:38
  • 1
    This is beautiful; also it's the "best" counterexample in the sense that for this particular $d$, there are no solutions to $\binom{x}{d} \equiv r \pmod m$ other than the inevitable $r \equiv 0$ and $r \equiv 1$. BTW, for reference, the "well-known congruence" is called Lucas's theorem. – ShreevatsaR Jul 29 '13 at 17:45
  • 1
    BTW, this also fits as a special case into the last part of my answer: when $d=p-1$ for prime $p$, one particular $m$ we can take with $\gcd(d!, m) = 1$ is $m=p$, for which we get $d-1 = p-2$ values of $r$ with no solution to $\binom{x}{d} = r$, exactly as this answer shows. So in principle we don't even need Lucas's theorem, just the non-constructive argument of the other answer works constructively in this case because it says there are $p-2$ "unattainable" remainders and we already know the other $2$ "attainable" remainders $0$ and $1$. – ShreevatsaR Jul 29 '13 at 18:04
  • @ShreevatsaR, that's a nice observation. +1 to your answer and use of periodicity has been there from the beginning. I was so set on using Lucas that I neglected periodicity altogether. – Jyrki Lahtonen Jul 29 '13 at 18:21
  • @YACP: Warm thanks for spotting and fixing a typo. – Jyrki Lahtonen Jul 30 '13 at 08:40
3

This will answer your motivation and in particular the question.

We want to prove that $f(x)=x+a$ are the only possibilities for such a polynomial.

Consider the polynomial $g(x)=f(x+1)-f(x)$. By looking at primes $p$, large enough, so that all denominators in the coefficients of $f$ are prime to $p$, we can assume $f$ has integer coefficients from now on. We want the congruences $f(x)=r\ (\text{ mod }p)$ to have solutions for all $r=0,1,\ldots,p-1$. Then $f(0),f(1),\ldots,f(p-1)$ must give all remainders $0,1,\ldots,p-1$. In particular they all must be different. Therefore $g(0),g(1),\ldots,g(p-1)$ are not zero mod $p$. Otherwise we don't get all the remainders out of $f$.

Lemma: If $g$ is non-constant then we can make $g(n)$ divisible by arbitrary large primes.

Proof: I wrote the proof of this lemma in this answer to another problem.

Take $g(M)$ for $M$ very large such that $g(M)$ is divisible by a very large prime $p$ with the conditions above (such that this prime is prime with all denominators in the coefficients of $f$). Then $f(x)=r$ will not always be solvable mod this prime $p$.

Therefore $g$ is constant. Hence $f$ is linear. From this we get that the leading coefficient of $f$ must be $1$ (otherwise mod a prime that divides this coefficient we don't get all remainders) and we get the solution $f(x)=x+a$, which does work.

OR.
  • 5,941