Let $p\in \mathbb{Z}_{\geq 1}$ be a prime number, and consider the ring $\mathbb{Z}_{p}$ of $p$-adic integers. Now every rational number $n \in \mathbb{Q}$ is a $p$-adic integer for all but finitely many primes $p$, so for any given $n \in \mathbb{Q}$ let us ignore the finitely many primes where this is not the case.

Every $n \in \mathbb{Z}_{p}$ has a unique expression of the form $$a_0+a_1p+a_2p^2+\dots$$ where $0 \leq a_i \leq p-1$ for every $i\geq 0$.

Now for any given $n \in \mathbb{Q}$ there are only finitely many primes $p$ such that $n \in \mathbb{Z}_{p}$ and $a_0=0$. In other words, $n$ is a unit element in $\mathbb{Z}_{p}$ for almost all prime $p$.

My question is: can we say the same about the other coefficients $a_1,a_2,\dots$? For a given $n \in \mathbb{Q}$, is $a_1=0$ for only finitely many primes $p$?


As for context, this problem is a toy instance of a subproblem that arose as part of my attempt at this question I had asked earlier: When can an algebraic number be approximated by a $p$-adic number? Evidently, that question is not juicy enough to attract eyeballs, and requires more background. However, this simpler formulation captures the core of that problem (I think). I apologize if the solution turns out to be trivial, but clearly I am missing the picture.

UPDATE: As was pointed out in the comments (sorry and thanks!), I had worded the question wrong earlier. I think I have rectified it now, but if its still silly, I'll edit it again.

  • 2
    $\begingroup$ Actually, it's true for infinitely many primes for any $n$, because for infinitely many primes, $p>n$ so $n\bmod p = n\bmod {p^2}=n$. $\endgroup$ Dec 6, 2016 at 20:44
  • $\begingroup$ This holds for every integer. $\endgroup$
    – davidlowryduda
    Dec 6, 2016 at 20:45
  • $\begingroup$ Doesn't every integer $n$ have an infinite set of primes such that $n\pmod{p_i^2} =n\pmod{p_i} $, namely, the set of all primes greater than $n$? Did you mean to ask a different question? $\endgroup$ Dec 6, 2016 at 20:48
  • $\begingroup$ Oh! You're right! This isn't what I had in mind then. I'll remove this question and reword it better. Meanwhile, do check out the original question linked above. $\endgroup$
    – BharatRam
    Dec 6, 2016 at 21:05
  • $\begingroup$ @ThomasAndrews , Mark Fischler and mixedmath: Thanks for pointing it out. I had considered that earlier, but somehow forgot about it when typing down the question. I have corrected it now, and hopefully my essential problem is conveyed. Do tell me if there's more to fix. Thanks. $\endgroup$
    – BharatRam
    Dec 6, 2016 at 21:31

1 Answer 1


This is true for all positive integers $n$: For any $p > n$ we have $n \pmod{p^2} = n \pmod p = n$.

On the other hand, if $p \le n < p^2$ then $n \pmod{p^2} \ne n \pmod p$, so no integers $> 1$ will have $n \pmod{p^2} = n \pmod{p}$ for all primes $p$.

EDIT: For the revised (and completely different) question, if $n$ is a nonnegative integer and $p$ is a prime $> n$, then the $p$-adic expansion of $n$ has $a_0 = n$, $a_j = 0$ for $j \ge 1$. But these are the only examples.

If $n$ is a negative integer and $p > -n$, the $p$-adic expansion of $n$ is $(p+n) + (p-1) p + (p-1) p^2 + \ldots$, so $a_1 \ne 0$.

Finally, suppose $n = c/d$ (in lowest terms) is not an integer. Let $p$ be a prime $> 2 \max(c,d)$. In order for the $p$-adic expansion to be $\dfrac{c}{d} = a_0 + 0 p + \ldots$, we need $p^2 \mid c - a_0 d$. But $0 < a_0 < p$, and $|c - a_0 d| < p/2 + p^2/2 < p^2$, so this implies $c - a_0 d = 0$, contradicting our assumption $c/d$ is not an integer. So there can be only finitely many $p$ for which $a_1 = 0$.

  • $\begingroup$ Hello Robert ! I had hastily worded the question earlier. That was not what I meant at all. Its totally my fault, and I have corrected the question now. I apologize for the error, and please forgive me for wasting your attention on a triviality. Also please do have a look at the edited question too. I'll constantly update it if its not clear enough. Thanks! $\endgroup$
    – BharatRam
    Dec 6, 2016 at 21:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.