For $n \geq 2$, let $r(n)$ be the previous prime to $n$; i.e., the largest prime strictly less than $n$. For example, $r(3) = 2$, $r(10) = 7$, and so on.

I have noticed that, usually, if you reverse the digits of $r(n^3)$ in base $n$, you obtain a smaller number. For example, $r(5^3) = 113 = 423_5$, and reversing the digits base $5$ gives $324_5 < 423_5$. This also seems to hold for powers other than $3$. Is this true in general? (For sufficiently large $n$, say.) If so, why? Is there a simple proof?

Here are three examples to show that, somehow, $r(n^3)$ is necessary: $47$ is a prime less than $10^3$ whose second digit is larger than its first; $999$ is closer to $1000$ than $r(1000)$, but reversing it in base $10$ gives the same number; $414_5 = 109$ is a prime less than $5^3$ which is fixed under reversal of base 5 digits.

Here's the start of an argument for squares: Let $p = r(n^2) = d_1 n + d_0$, where $d_k \in \{0, 1, 2, \dots, n - 1\}$. We can't have $d_1 = d_0$ since $p$ is prime (omitting some details). If we could prove $d_1 = n - 1$, then this would imply $d_0 < d_1$, so reversing the digits of $p$ would produce a smaller number. We have $d_1 = \lfloor p / n \rfloor$, so it would suffice to prove $$n - 1 \leq \frac{p}{n} < n,$$ or $$1 - \frac{1}{n} \leq \frac{r(n^2)}{n^2} < 1.$$ Based on my question here, this last thing seems difficult to prove.

  • 1
    $\begingroup$ Searched $n$ up to 1000000 only 2,3 prevail. previous prime must fit $n-1$ mod $n$ or fail. This follows from weak application of Bertrand's postulate. $\endgroup$
    – user645636
    Nov 24, 2019 at 2:49
  • $\begingroup$ @RoddyMacPhee Thanks for checking more powers! Can you say more about why the previous prime must be $n - 1 \mod n$? I don't see why yet. $\endgroup$
    – Robert D-B
    Nov 24, 2019 at 2:53
  • $\begingroup$ $p>{ n\over 2}$ sorry. $\endgroup$
    – user645636
    Nov 24, 2019 at 2:56

1 Answer 1


What I can tell you:

  • $n-1\leq {p\over n}\leq n\implies$ $(n-1)^2< n^2-n\leq p\leq n^2$ making this condition, a restricted form of Legendre's conjecture( so part of an unsolved problem, it's actually Oppermann's conjecture in disguise).
  • Via Bertrand's postulate, for an $m$ base $n>2$ digit number, you get $d_m\geq d_0\geq \lfloor {n\over 2}\rfloor$ .
  • The cube case, becomes problematic on the Bertrand's postulate front. $5^3<2(4^3)$ , However most stronger heuristics, I feel, are likely to support it.

You must log in to answer this question.

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