Tuesday 31 August 2010

11 and more...

For those that have seen the previous blogs, you'll know that I've been talking about ways of computing factors of numbers. Everything I've talked about is related to the fact that you can sum the digits of numbers, and find out whether the original number is a multiple of 9 (or 3). I also showed that you can use a similar method to show whether any number is a factor of another.
But what I hadn't thought about (though nothing precluded it), is what happens when the factor is greater than the base number.

For example, before we talked about numbers which were multiples of 9. But what about 11, which is 1 greater than the base?

Well, it turns out that that works too!

Remember that the constraint is that
a + b*r^1 + c*r^2 + .. + k*r^n
be a multiple of f - the factor we're looking for.

Now, originally I'd imagined that f was less than than the base value (ie <10) giving a positive remainder r. But it still works for negative r.

The simplest case is that of the numbers which are multiples of 11, which gives remainder of -1. Pluging in r=-1 into the above equation, you see that the equation for 11ssss reduces to
a - b + c - d + ...

ie you just alternatively add and subtract the digits of the original number (going from right to left), then check to see whether the answer is a multiple of 11 or not.

One thing to be aware of is that the sum can equal 0. Which implies that its a multiple of 11, as in the case of 121 (+1-2+1 = 0).


2 comments:

  1. Hello Simon,
    Interested in cryptography?
    Pierre

    ReplyDelete
  2. Surpisingly, I am. Though I don't think the NSA, MI6 or ANSSI have anything to worry about!

    ReplyDelete