I was reading about numbers, when I came across this amazing fact/unique property of the number $189$ :

The product of four distinct primes (bigger than $10$) which differ only in their last digits (if it exists) always ends in $189$.

Is there a good way to prove this ? There are infinitely many examples which satisfy this, since there are infinitely many primes. Also, why does it not work for primes below $10$? I am not very familiar with number-theory, so I can not do much "modulos" and other "commonly-used" methods in number theory. So, I can not post any of my own "research/effort/work" on the problem. What I have done is just tested the fact on various primes $\Big($:-($\Big)$.

Thanks in Advance ! :-)

  • 4
    $\begingroup$ $(10 k + 1)(10 k + 3)(10k + 7)(10k + 9) = 10000 k^4 + 20000 k^3 + 13000 k^2 + 3000 k + 189$. $\endgroup$
    – user49640
    Commented Feb 24, 2017 at 8:29
  • $\begingroup$ It's not clear at all that there are infinitely many quadruples of primes with this property. This would imply the twin prime conjecture. $\endgroup$
    – user49640
    Commented Feb 24, 2017 at 8:31
  • $\begingroup$ @user49640 OH!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! That was so simple !!! Thanks a lot !! :-) $\endgroup$
    – user399078
    Commented Feb 24, 2017 at 8:31
  • $\begingroup$ One can prove a "stronger theorem": A prime quadruple is a sequence of four consecutive primes $p$, $p+2$, $p+6$, $p+8$. For any such quadruple the decimal representation of the product of its members ends in 189. $\endgroup$ Commented Feb 24, 2017 at 13:59

2 Answers 2


It won't work for primes below $10$ because

$$2\cdot 3\cdot 5\cdot 7$$

does not end in $189$.

However, if the primes are bigger than $10$, then their final digit can only ever be $1,3,7$ or $9$. Given that the four primes only differ in the last digit, and the last digit is one of four possible digits, you also know that all of these digits will be taken. In other words, the primes will be equal to

$$10k + 1\\10k+3\\10k+7\\10k+9$$

Now, have a look at the product of these four numbers.

  • $\begingroup$ Sorry I deleted the question. I actually did not know that you have posted an answer. I thought that the question is a very stupid one, so I thought of deleting it. Anyways thanks for the answer :-). $\endgroup$
    – user399078
    Commented Feb 24, 2017 at 9:20
  • $\begingroup$ @Nirbhay The question is pretty far from stupid if you ask me. $\endgroup$
    – 5xum
    Commented Feb 24, 2017 at 9:21
  • $\begingroup$ For me it will be stupid question LOL. XD . Can you please help me out with this one ????? I'll be grateful to you.... $\endgroup$
    – user399078
    Commented Feb 24, 2017 at 9:23

Four primes greater than $10$ that differ only in their last digit will need to have the corresponding number that ends in $5$ be divisible by $3$, so will be of the form $30m+k$, with $k$ values of $\{11,13,17,19\}$.

The last $3$ digits of their product $(30m+11)(30m+13)(30m+17)(30m+19)$ will be the same as the last $3$ digits of:

$\begin{align}& A+B+C \\ \text{where } &A:=900m^2(11\cdot13+11\cdot17+11\cdot19+13\cdot17+13\cdot 19+17\cdot19) \\ &B:= 30m(11\cdot13\cdot17+11\cdot13\cdot19+11\cdot17\cdot19+13\cdot17\cdot 19)\\ & C:=11\cdot 13\cdot17\cdot 19 \end{align}$

...because as soon as we have a factor of $1000$ in a term, it no longer affects the last three digits. Also because of this, we can simplify the first term above:

$\begin{align} A' &:= 900m^2(1\cdot3+1\cdot7+1\cdot9+3\cdot7+3\cdot 9+7\cdot9)\\ &= 900m^2(3+7+9+21+27+63) \\ &= 900m^2(120) \end{align}$

Now we see that this first terms is divisible by $1000$ so is no longer interesting, so we can ignore it and proceed with $B$, the $30m$ term:

$\begin{align} B &= 30m(11\cdot13\cdot17+11\cdot13\cdot19+11\cdot17\cdot19+13\cdot17\cdot 19)\\ &= 30m(30\cdot13\cdot17+30\cdot11\cdot19) \\ &= 900m(221+209) \\ &= 900m(430) \\ \end{align}$

So $B$ is also divisible by $1000$ and the last $3$ digits will just match those of $C$, which doesn't depend on $m$.

$\begin{align} C &= 11\cdot13\cdot17\cdot 19)\\ &= 221 \cdot 209 \\ &= 46189 \\ \end{align}$

giving the last three digits as $189$ as claimed.


You must log in to answer this question.