# Roohullah's prime

Roohullah wrote his favorite positive integer $m$ down on a piece of paper. Then Roohullah computed the value $m+m^2+m^3+.....+m^{2m-3}-4$. Roohullah noticed that this value was a prime number. Now I ask you: What are the possible values for the unit digit (last digit) of $m$?

• Presumably $m > 1$. – Ian MacDonald Mar 11 '16 at 17:49

The only possible unit digit is $5$.

Reasoning

We'll assume $m>2$ so the result is non-negative. If $m$ is even then Roohullah's result is even and not prime; hence we'll only consider odd $m$.

If $m$ ends in $1$ then Roohullah's result modulo $10$ is
$2m-3-4 \equiv 5 \bmod 10$.

If $m$ ends in $3$, Roohullah's result modulo $10$ is $(3+9+7)+(1+3+9+7)\left(\frac{m-3}{2}\right)-4 \equiv 5 \bmod 10$

If $m$ ends in $5$, Roohullah's result modulo $10$ is
$10m-15-4 \equiv 1 \bmod 10$

If $m$ ends in $7$, Roohullah's result modulo $10$ is $(7+9+3)+(1+7+9+3)\left(\frac{m-3}{2}\right)-4\equiv 5 \bmod 10$

If $m$ ends in $9$, Roohullah's result modulo $10$ is
$9+(1+9)\left(m-1 \right) -4\equiv 5 \bmod 10$

Since a result ending in $5$ won't be a prime number, the only possibility for the last digit of $m$ is $5$. To show that the prime criteria can be achieved, note that
$5 + 5^2 + 5^3 + \ldots + 5^7 - 4 = 97651$ which is prime.

• You have been faster than me, just by a few moments. Nice answer. – Gamow Mar 11 '16 at 14:14