Divisibility by Four and Eight

Divisibility By Four

Divisibility Rule

Suppose we have an integer N. It could be written in the following form:

10^n * a_n + ... + 10 * a_1 + a_0

Since 100 is divisible by 4, all the parts with index n > 1 can be ignored.
But how to tell whether 10 * a_1 + a_0 is divisible?

The trick is to use the fact that 20 is also divisible by 4.
And any number that could be represented as 2n * 10 is divisible by 20.

Therefore, in order for the whole number to be divisible by 4, if the penultimate digit is even, the last digit must be divisible by 4 (so it has to be 0, 4 or 8).

And if the penultimate digit is odd, the last digit must be even and not divisible by 4 (so it’s either 2 or 6).

Obviously, if the last digit is odd, the whole number is not divisible by 4.

Proof

Part 1

2 * n * 10 + a = 20 * n + a

20 * n is divisible by 4 because 20 is divisible by 4.

A positive single-digit number a is divisible by 4 only if a is 0, 4 or 8. There are no other (positive) single-digit numbers divisible by 4.

Part 2

(2 * n + 1) * 10 + a = 20 * n + 10 + a = 20 * n + 8 + 2 + a

As we’ve already seen, 20 * n is divisible by 4.
8 is also divisible by 4. So we can omit this part, and what we are left with is:

2 + a = 4 + (a - 2)

In order for the whole number to be divisible by 4, we need a - 2 to be divisible by four.

A positive single-digit number a minus 2 is divisible by 4 only if a is 2 or 6.

Divisibility By Eight

Divisibility Rule

Same logic applies, with a few alterations.
1000 is divisible by 8, so we only have to consider this part:

100 * a_2 + 10 * a_1 + a_0

Interestingly, 20 * 10 is also divisible by 8.
Since we now have three digits to care about instead of two, things get a bit more complicated. But the idea is the same.

Again, the 2 * n * 100 number is divisible by 8, so we can omit this part.

  1. If the last digit is odd, obviously the original number is not divisible by 8.

  2. If the last digit is 8:
    and if the first digit of three-digit number is even,
    then the original number is divisible by 8 if the second digit is 0, 4 or 8.

    And if the first digit of three-digit number is odd,
    then the original number is divisible by 8 if the second digit is 2 or 6.

  3. If the last digit is 6:
    and if the first digit of three-digit number is even,
    then the original number is divisible by 8 if the second digit is 1, 5 or 9.

    And if the first digit of three-digit number is odd,
    then the original number is divisible by 8 if the second digit is 3 or 7.

  4. If the last digit is 4:
    and if the first digit of three-digit number is even,
    then the original number is divisible by 8 if the second digit is 2, or 6.

    And if the first digit of three-digit number is odd,
    then the original number is divisible by 8 if the second digit is 0, 4 or 8.

  5. If the last digit is 2:
    and if the first digit of three-digit number is even,
    then the original number is divisible by 8 if the second digit is 3 or 7.

    And if the first digit of three-digit number is odd,
    then the original number is divisible by 8 if the second digit is 1, 5 or 9.

  6. Finally, if the last digit is 0:
    and if the 3 digit-number divided by 10 is divisible by 4,
    then the original number is divisible by 8.

Proof

Proof is pretty much the same as in the case of divisibility by 4.
But let’s take a look at it anyway.

Last Digit 8

2 * n * 100 + 10 * a + 8 = 200 * n + 10 * a + 8 = 200 * n + (5 * 2) * a + 8

200 * n is divisible by 8 because 200 is.
8 is obviously divisible as well.

For 5 * 2 * a to be divisible by 8, 5 * a must be divisible by 4. For that to be true, a must be divisible by 4, since 8 = 2 * 4. So a can only be 0, 4 or 8 for the original number to be divisible.

(2 * n + 1) * 100 + 10 * a + 8 = 200 * n + 96 + 4 + (5 * 2) * a + 8

Again, we can ignore the 200 * n + 96 + 8 part which leaves us with:

4 + (5 * 2) * a = 2 * 2 + 5 * 2 * a = 2 * (2 + 5 * a)

Therefore, 2 + 5 * a must be divisible by 4 in order for the original number to be divisible by 8.

Which means that 5 * a must be an even number that is not divisible by 4. Which in turn means that a must be an even number as well. Since it is also a single-digit number, it only leaves us with 2 and 6.

This is the proof for the case #1. Notice its symmetry with the case #3.

Last Digit 6

Cases #2 and #4 are similar and have the same symmetry, but let’s review one of them anyway, #2 for example.

2 * n * 100 + 10 * a + 6 = 200 * n + 10*a + 6

Again, 200 is divisible and can be ignored.

10 * a + 6 = 5 * 2 * a + 2 * 3 = 2 * (5 * a + 3)

So 5 * a + 3 must be divisible by 4.

1
2
3
4
5 * a + 3 =
(4 + 1) * a + (4 - 1) =
4 * a + a + 4 - 1 =
4 * (a + 1) + a - 1

4 * (a + 1) is divisible by 4, and for a - 1 to be divisible, given that a is a positive single digit number, a must be 1, 5 or 9.

1
2
3
4
(2 * n + 1) * 100 + 10 * a + 6 =
200 * n + 96 + 4 + 10 * a + 6 =
200 * n + 96 + 10 + 10 * a =
200 * n + 96 + 10 * (a + 1)

Again, 200 and 96 can be omitted.

1
2
10 * (a + 1) =
5 * 2 * (a + 1)

Therefore, 5 * (a + 1) must be divisible by 4.
Let’s apply the same trick:

1
2
(4 + 1) * (a + 1) =
4 * (a + 1) + (a + 1)

4 * (a + 1) is obviously divisible by 4.

And in order for a + 1 to be divisible by 4, a must either be 3 or 7 (since it is a positive single digit number).

Same works for case #4.

Last Digit 0

Case #5 is a bit different though.
The corresponding numbers could be represented like this:

100 * n + 10 * a + 0

But we might as well represent it this way:

10 * a = 5 * 2 * a

For 5 * 2 * a to be divisible by 8, 5 * a must be divisible by 4.
And for that, a must be divisible by 4, since 5 is not.

Thus, if the last digit is 0 and the original number divided by 10 is divisible by 4, then the original number is divisible by 8.

On the Nature of Human Intelligence

Humans

It’s easy to transfer information. I’ve just did that. It is much more difficult to convey understanding between humans. But why?

When we study, we don’t just copy-paste information to our brain as if it is a computer’s memory unit. We have to employ techniques like spaced repetition, we also have to relate new pieces of data to something we already know (because associations make it easier to remember).

Once someone is taught how to, say, solve a particular type of math problems, the person still fails from time to time. When you learn how your friend looks, you can still occasionally mistake someone else for that person.

Why do we make such errors? The nature of our learning is building particular patterns in our neural network.

As we’ve recalled, building those patterns takes time and is error-prone.
Both could be evolutionary disadvantages. How come the survived species use this approach instead of the alternative?

Pattern-matching might take time to build patterns, but once built those patterns work fast. In a split second you might recognize a sign of a predator nearby.

In terms of evolution, staying alive and procreating has apparently been more important than reasoning.

Reasoning

Reasoning, on the contrary, always takes time to come to a particular result, deriving a chain of conclusions.

Evidently the world is too complex for us to derive necessary conclusions in time.

Consider the history of scientific advancements. There are lots of examples where a theorem or a hypothesis is stated long before the proof was made. There is no guaranteed algorithm to arrive at a new discovery; it is usually an application of one field’s (quite abstract) pattern to another field.

Intelligence

Suppose you try to replicate a horse to provide yourself an artificial means of transport. How many iterations would it take you to arrive at the concept of a wheel? Horse’s legs are nowhere near that. Its digestive system has no resemblance to the internal combustion engine. Maybe at some point you’ll have your synthetic horse, but it’s still not a car.

Throughout the history of building artificial intelligence, a few tasks have been suggested to test the AI agents against. Indeed, at first it seems as if the task requires intelligence to be solved. But that illusion dissolves once you’ve got the algorithm working. It’s called AI effect.

These observations lead me to a counter-intuitive conclusion. And yet it is the one that doesn’t contradict the observable facts.

Humans are not intelligent.

We are pattern matching machines. That’s why replicating our brains to the best extent currently possible only gives us pattern matching algorithms.

That explains our self-contradicting behavior (different patterns may fire up simultaneously). That explains the power of analogies and examples in teaching, negotiations and communication in general. That’s why humans can disagree while observing the same evidence. That’s why the good stories have the same structure. That’s why discoveries are made by accident. That’s why you forget your great ideas unless you write them down — yes, you’ve got the same experience, the same facts, skills, everything, but you didn’t derive the conclusion, you accidentally matched particular patterns.

Take a look at any futuristic painting or a sci-fi story of the past. They all have one thing in common — linear extrapolation by a couple of dots. That’s exactly how some machine learning models work. This approach always fails when you try to predict a future state of a nonlinear dynamic system (next month’s weather or stock prices, for example).

Instead of true reasoning (yet to be invented) we merely apply patterns, that sometimes resemble it (other times we make mistakes).

A reasoning agent will be able to apply an algorithm to make scientific advances. Contrast that with our brute force approach (since we don’t know which pattern to apply each time).

The major downside of this hypothesis is that it doesn’t explain consciousness.
Maybe we need a real intelligence to solve that.