First, I'll discuss quick ways for deciding whether a number is divisible by various small integers. In what follows, I'll assume that numbers are represented as strings of decimal digits (i.e. in base 10) as usual.
Proposition. (a) An integer is divisible by 2 if and only if its last digit is divisible by 2.
(b) An integer is divisible by 5 if and only if its last digit is 0 or 5.
Proof. The proofs for these two tests are nearly identical; I'll do the one for divisibility by 2 as an example.
Suppose the decimal representation of x is
That is, is the units digit, is the tens digit, and so on. For 1728,
Then
Since , it follows that for . Thus, if and only if --- that is, x is even if and only if the units digit is even.
Definition. The digital sum of an integer n is the sum of the digits in the decimal representation of n.
For instance, the digital sum of 1728 is 18:
The digital sum of 278349 is 33:
Proposition. (a) An integer is divisible by 3 if and only if its digital sum is divisible by 3.
(b) An integer is divisible by 9 if and only if its digital sum is divisible by 9.
Proof. Suppose the decimal representation of x is
Then
The sum of the digits of x is
Observe that
The right side is divisible by 3 and by 9, because
That is,
Hence, if , then , and if , then . And if , then , and if , then .
Note that you can continue to sum the digits of the numbers that you get until you get something that is obviously divisible by 3 or 9. For example, start with 893948083:
Since 7 is not divisible by 3 or by 9, neither is 52. Since 52 is not divisible by 3 or by 9, neither is 893948083.
The next result can be proved by a method similar to that used to prove the test for divisibility by 9. Since the proof is a little more complicated, I'll merely state the result and give an example.
Proposition. To test divisibility by 7, remove the last (units) digit, double it, and subtract it from the remainder of the number. The original number is divisible by 7 if and only if the result is divisible by 7.
Example. Use the test in the proposition to test 9423242 for divisibility by 7.
86 is not divisible by 7, so 9423242 is not divisible by 7.
It is difficult to factor a large, arbitrary integer in a reasonable amount of time. You can use simple divisibility tests like those above to deal with "obvious" cases, but the general problem is difficult, and the object of current research.
I'll describe a simple factoring method called Fermat factorization.
Proposition. Let n be an odd integer. There is a one-to-one correspondence
Proof. If , n is odd so a and b are odd. Then and are even, so and are integers. Now
This expresses n as a difference of two squares.
Conversely, suppose n is written as as difference of squares: . Then
This is a factorization of n.
You can check that these two procedures --- factors to difference and difference to factors --- "undo" one another.
Example. Use Fermat factorization to factor 4819.
The idea is to try to write 4819 as . I will form and increase s till I get a perfect square. What s's do I need to use?
First, . Since , s must be at least as big as .
On the other hand, the factorization with the biggest factor is . By the proof of the last result, this would produce an s of the form . So I need to try s for .
On the very first try,
Thus, and . , , and .
Example. Use Fermat factorization to factor 779.
, so I need . , so .
The factors are and : .
Copyright 2019 by Bruce Ikenaga