0
$\begingroup$

Given an odd prime $p$, a positive integer $1 \lt n$, and an integer $x \in \mathbb{Z}/p^n\mathbb{Z}$, does there exist an an integer-coefficient polynomial that extracts the highest digit of $x$?

The extracted digit can be (1) $mod-p^n$ or (2) $mod-p$.

(1) For example, if the result is $mod-p^n$, $f(x)=x-(x\ mod\ p^{n-1})\ (mod p^n)$. This $f(x)$ actually clears the lower digits of $x$. Suppose $x=\sum_{i=0}^{n-1}x_ip^i$ where $x_i \in \mathbb{Z}/p\mathbb{Z}$ is each digit of $x$, then $f(x)$ maps $x=(x_{n-1},x_{n-2},...,x_1,x_0)$ to $(x_{n-1},0,...,0,0)$.

(2) If the result is $mod-p$, then $f(x)$ maps $x=(x_{n-1},x_{n-2},...,x_1,x_0)$ to $x_{n-1}$.

Does either of these polynomials $f(x)$ exist? Thanks in advance.

$\endgroup$
4
  • $\begingroup$ Do you want something to happen for all $x\in\Bbb{Z}/p^n\Bbb{Z}$, or do you simply need it to work for every integer in the range $0\le x<p^n$? $\endgroup$ Commented Jun 27 at 4:17
  • $\begingroup$ @Jyrki Lahtonen $0\leq x \lt p^n$ would be enough. But if $f(x)$ exists for all $x \in \mathbb{Z}/p^n\mathbb{Z}$, it would more general. $\endgroup$
    – fofo
    Commented Jun 27 at 4:24
  • 1
    $\begingroup$ Are you looking for a function from $\Bbb{Z}$ to $\Bbb{Z}$, from $\Bbb{Z}/p^n\Bbb{Z}$ to $\Bbb{Z}/p\Bbb{Z}$ or what? Some of the things in your question are rather confusing. For example, if $x\in\Bbb{Z}/p\Bbb{Z}$, then $p^ix=\overline{0}$ for all $i>0$. It looks like you write $\Bbb{Z}/p\Bbb{Z}$ even though you really mean the set $\{0,1,\ldots,p-1\}$. The reason I'm asking is that many askers, those with only programming background in particular, are not aware of the difference. $\endgroup$ Commented Jun 27 at 4:27
  • $\begingroup$ @Jyrki Lahtonen Sorry for the condusion. Yes, I mean each digit is from $\{0,1,…,𝑝−1\}$ and I just mistook $\mathbb{Z}/p\mathbb{Z}$ for the same thing. Basically I am looking for a function that extracts or removes the highest digit of a number from $\{0,1,…,𝑝^n−1\}$. Such as mapping $(x_{n-1},x_{n-2},...,x_1,x_0)$ to $(x_{n-1},0,...,0,0)$ or $(0,x_{n-2},...,x_1,x_0)$ or $x_{n-1}$, where each $x_i$ is a digit from $\{0,1,…,𝑝−1\}$. $\endgroup$
    – fofo
    Commented Jun 27 at 4:33

3 Answers 3

2
$\begingroup$

It is still not clear to me what exactly is being asked because the question mixes binary mods (=the remainder function) and quotient rings, and the range of the variable is unclear. Anyway, the point of this answer is to explain why certain things are impossible.

Fact. If $f(x)=\sum_{i=0}^n a_ix^i$ is a polynomial with integer coefficients, $p$ is a prime number, and $m\equiv n\pmod p$, then $$f(m)\equiv f(n)\pmod p.$$

Proof. Raising to a power preserves a congruence, so we have $m^i\equiv n^i\pmod p$ for all $i$. Congruences also preserve integer linear combinations, and the claim follows.

Corollary. It is impossible to find a polynomial $f(x)\in\Bbb{Z}[x]$ such that for all choices of base-$p$ digits $n_i\in\{0,1,\ldots,p-1\}$, $0\le i<m$, we would have $$ f(\sum_{i=0}^{m-1}n_ip^i)=n_{m-1}. $$

Proof. The base-$p$ expansions the integers $x_1=p^{m-1}$ and $x_2=p^{m-1}-p$ have disting top digits: with $x_1$ we have $n_{m-1}=1$ but with $x_2<p^{m-1}$ the "leading digit" is equal to zero. Yet $x_1\equiv x_2\pmod p$, so the Fact implies that $f(x_1)\equiv f(x_2)\pmod p$. But $1\not\equiv0\pmod p$, so we have run into a contradiction.


As Greg Martin explained, it is also impossible to find a polynomial $f(x)\in\Bbb{Z}[x]$ such that for all natural numbers $$ n=\sum_{i=0}^{m-1}n_ip^i, \quad n_i\in\{0,1,\ldots,p-1\}, $$ we would have $$f(n)=n_{m-1}p^{m-1}.\qquad(*)$$ Recapping the reason: $(*)$ implies that $0\le f(n)/n \le 1$ for all natural numbers. Hence $f(n)$ has linear growth, implying that $f(n_1)>f(n_2)$ whenever $n_1>n_2$, which is a contradiction.

On the other hand, if we fix a prime $p$, and a natural number $m$, then it is possible to find a polynomial $f(x)\in\Bbb{Q}[x]$ such that for all $n$ in the range $0\le n<p^m$ we have $f(n)=n_{m-1}p^{m-1}$. Again $n=\sum_in_ip^i$ with $n_i\in\{0,\ldots,p-1\}$. This is a simple application of Lagrange interpolation. For example with $p=m=2$ the polynomial $$ f(x)=\frac13(-7x+9x^2-2x^3) $$ has the prescribed values $f(0)=f(1)=0$, $f(2)=f(3)=2$. Here

  • I don't know right away, if it might be possible to replace $f$ with another polynomial with integer coefficients.
  • In the linked MO-thread the answer seems to produce a polynomial with rational $p$-adic integers as its coefficients. Basically it allows rational coefficients as longs as the numerators are not divisible by $p$.
$\endgroup$
2
  • $\begingroup$ I suppose we can not find $f(x)$ to remove the highest digit from $x$ either? I had thought "removing the lowest digit" and "removing the highest digit" are symmetric. But now it seems only the former is viable. $\endgroup$
    – fofo
    Commented Jun 27 at 5:34
  • $\begingroup$ Thanks for your great answer! I have this question because in this post, it has been proven that there exists some 𝑓(𝑥) that can remove the lowest digit from 𝑥. But it is not feasible to find such 𝑓(𝑥) to remove the lowest k digits, as proven in section 4 in this note. And by your proof, there exists no 𝑓(𝑥) that extracts the highest digits of 𝑥 neither. $\endgroup$
    – fofo
    Commented Jun 27 at 5:42
0
$\begingroup$

No. In the first case, $f(x)/x$ is bounded between $1/2$ and $1$; any polynomial with that property must be a linear polynomial, but no linear polynomial can work. In the second case, $f(x)$ is itself bounded; any polynomial with that property must be constant, but those can't work either.

$\endgroup$
3
  • $\begingroup$ Thanks for your answer. Accoding to your answer, removing the highest digit will also be impossible? (Such as mapping $x=(x_{n-1},x_{n-2},...,x_1,x_0)$ to $(0,x_{n-2},...,x_1,x_0)$.) I see there is a huge gap between removing the highest digit and removing the lowest digit, as the latter has been proven possible in mathoverflow.net/questions/269239/… $\endgroup$
    – fofo
    Commented Jun 27 at 3:25
  • $\begingroup$ I think you need to be careful (in all these variants): do you require this property of the values of $f(x)$ as integers, or you require this property of the values of $f(x)$ as elements of $\Bbb Z/p^n\Bbb Z$? The answer is very different in the two cases: in the former case (which I assumed for my post) the answer is no to all such variants (including the one you linked to!); in the latter case, the answer is probably yes to all such variants. $\endgroup$ Commented Jun 27 at 17:08
  • $\begingroup$ Thanks for your reply! I consider the same setting as in the link I attached. In that link, Michael Griffin proved that there is such $f(x)$ that removes the lowest digit of x (and the values of $f(x)$ should be elements of $\mathbb{Z}/p^n\mathbb{Z}$). What I want is a different $f(x)$ that removes the highest digit of x (or some variants that extract the highest digit ). I understand the proof by Michael Griffin, but it seems that it cannot be extended to remove the lowest $(n-1)$ digits, as is shown in section4 in this note $\endgroup$
    – fofo
    Commented Jun 27 at 18:10
0
$\begingroup$

The ring $\mathbb{Z}_{p^n}$ is not a field. So it may fail to interpolate a polynomial in $\mathbb{Z}_{p^n}[X]$. This failure means that you can not find $f(X) \in \mathbb{Z}_{p^n}[X]$ to extract the highest digit.

To explain case (1) in detail, we explain the interpolation theory in the language of linear algebra. Suppose $\deg{d} = f(X)$. Then

$$ f(p_1) = a_1, \dots, f(p_{d+1}) = a_{d+1} $$

just means

$$ \begin{bmatrix} 1 & p_1 & \dots & p_1^d \\ \vdots & \dots & & \dots \\ 1 & p_{d+1} & \dots & p_{d+1}^d \end{bmatrix} \cdot \mathbf{f} = \begin{bmatrix} a_1 \\ \vdots \\ a_{d+1} \end{bmatrix} $$ where $\mathbf{f}$ is the coefficient vector of $f(X)$. Denote the above Vandermonde matrix by $Van_{d}(p_1, \dots, p_{d+1})$, whose determinant is $\Pi_{j > i} (p_j - p_i)$.

Lemma Let $R$ be a commutative ring. For a square matrix $M$ over $R$, $M$ is invertible in $M_n(R)$ $\Leftrightarrow$ $\det{M}$ is invertible in $R$.

Part of the interpolation theory says that $\mathbf{f}$ can be computed from $a_1, \dots ,a_{d+1}$ if $Van_{d}(p_1, \dots, p_{d+1})$ is invertible.

There are many zerodivisors in $\mathbb{Z}_{p^n}$, for example $p^{n-1} p = 0$. The matrix $Van_{p^{n}}(0,1,2, \dots, p^n - 1)$ is not invertible since its determinant is $0$. Therefore the interpolation theory fails.

Case (1) and (2) are actually the same on whether $f(X) \in \mathbb{Z}_{p^n}[X]$ exists. It can be solved using linear algebra.

$\endgroup$
5
  • $\begingroup$ Thanks for your answer. I know interpolation polynomials can be constructed to model some input-output pairs or for look-up-table evaluation, but I am not sure why interpolation can make case (2) possible but is not applicable to case (1). $\endgroup$
    – fofo
    Commented Jun 27 at 3:34
  • $\begingroup$ Although the interpolation fails, it is still possible to find a solution polynomail f(X) as in the answer. In linear algebra, even the matrix is not invertible, the equaiton may have solutions. $\endgroup$
    – Functor
    Commented Jun 27 at 4:09
  • $\begingroup$ Thanks for your nice explaination! Can I say that for case (2), it is always possible to find such $f(x)$ because the matrix $Van_p$ will always be invertible? Is there a bound for the degree of $f(x)$? $\endgroup$
    – fofo
    Commented Jun 27 at 4:15
  • $\begingroup$ Yes, $f(X)$ always exists because the matrix is invertible if the interpolation points are $0,1, \dots, p-1$. $\endgroup$
    – Functor
    Commented Jun 27 at 4:22
  • $\begingroup$ Maybe I did not make it clear in the question. In the second case, the input is still $mod\ p^n$, which means the input points are still from $\{0,1,...,p^n-1\}$. Thus we can not guarantee $f(x)$ exists? In the second case, $f(x)$ maps n-digit number from $\{0,1,...,p^n-1\}$ to its highest digit in $\{0,1,...,p-1\}$. $\endgroup$
    – fofo
    Commented Jun 27 at 4:46

Not the answer you're looking for? Browse other questions tagged .