Wednesday 21 October 2009

Checking for Divisibility by A Prime Number, Part 002

Here, I'll introduce a little terminology.

- The subject number is the number you are testing.

- The target number is the number for which you are testing for divisibility.

- The remnant is the number that remains.

First of all, check that your number is a prime number - that its only factors are 1 and itself. If the number is a non-prime, you'll have to check that the subject number is divisible by both or all factors.

Now work out the multiples of that number, from 1 to 5.

For example: the multiples of 7 from 1 to 5 are 7, 14, 21, 28, 35.

The multiples of 13 from 1 to 5 are 13, 26, 39, 52 and 65.

The multiples of 17 from 1 to 5 are 17, 34, 51, 68 and 85.

And so on.

Begin with your subject number.

Now either add to that subject number, or subtract from it, the multiple of your target number that leaves the last digit or digits as 0. Divide the remnant by 10 and repeat until you get a single digit. If that single digit is not 0, the number is not divisible.

Consider testing 15,579 by 19.

First, subtract 19 to leave 15,560. Getting rid of the 0 leaves 1,556. Subtracting (4x19=76) yields 1,480. Again, getting rid of the 0 yields 148. Subtracting (2x19=38) yields 110. Removing the 0 yields 11. Adding 19 yields 30; getting rid of the 0 yields a final digit of 3. This is clearly not zero, so 15,579 is not divisible by 19.

Another example: testing the divisibility of 345,246 by 13.

First, subtract (2x13=26) to yield 345,220. Dividing by 10 yields 34,522. Subtracting (4x13=52) yields 34,470; division by 10 produces 3,447. Adding 13 yields 3,460; discarding the 0 yields 346. Deducting another 26 yields 320. Dividing by 10 yields 32; adding (6x13=78) yields 110. Dividing by 10 yields 11; adding (3x13=39) yields 50, and a final division by 10 produces a single digit, 5. 345,246 is not divisible by 13.

This tool has just been added to my growing arsenal of mathematical techniques. I commend it to the house.

No comments:

Post a Comment