# Prime factorization rules

When you have a number like 81.

Is it safe to assume that if the number can't be divided by 2 or 3 that it's prime if it ends with a 1?

-

On a related note, you should realize that a number which ends in a 1 is NEVER divisible by 2 since it is odd. Also, ending with a 1 has nothing to do with the number being prime, and in fact there are infinitely many such primes by Dirchlet's theorem on primes in arithmetic progressions since 11,21,31,41,... is an arithmetic progression. In fact, the primes which end in 1 have the same relative density as those ending in 3,7, or 9 (the only other possibilities which lead to infinitely many primes since all others are divisible by either 2 or 5).

-
Moreover there are infinitely many composites ending in $1$. More preicsely, knowing that a large number has final decimal digit $1$ does not affect its "probability" of being prime, a consequence of the Prime Number Theorem in Arithmetic Progressions. – Pete L. Clark Jun 14 '11 at 22:43
+1: @Rofler: Nice answer! – amWhy Jun 14 '11 at 22:49
+1 @Rofler: Well put. – Jack Henahan Jun 14 '11 at 23:25

Definitely not, the smallest two examples are $91=7\times 13$ and $121=11\times 11$. (I am not counting $1$ as an example, though technically it qualifies!)

In fact, there are infinitely many non-primes of the required type, that is, ending in a $1$ and not divisible by $3$. There are also infinitely many primes of that type.

With smallish numbers, a substantial proportion of the numbers of the required type are prime. But after a while, the primes of that type "thin out". If you pick a huge number of that type "at random", then with high probability it will be a non-prime.

Comment: You can "roll your own" counterexamples. Suppose that one of the following holds:

(i) $a$ and $b$ end in $1$ and are not divisible by $3$, or

(ii) $a$ and $b$ end in $9$ and are not divisible by $3$, or

(iii) one of $a$ and $b$ ends in a $3$, the other in a $7$, and neither is divisible by $3$.

Then $a \times b$ ends in a $1$, is not divisible by $3$, and is not prime.

So for example pick $a=11$, $b=31$. Their product $341$ ends in a $1$, is not divisible by $3$, and is not prime.

-