There was an interesting conversation I found on the CodeVision Discord server. Here is a screenshot:

$$ 2^{2^{77,232,917}} - 1 $$

Now we have this number, but it’s obviously huge, so we don’t want to calculate all those digits out and figure out if the number is prime.

However, it is worth noting that

$$ 2^{n} $$

where `n`

is a number greater than or equal to `2`

is always a multiple of `4`

. This means `2`

raised to `n`

is a multiple of `4`

iff `n`

is an integer greater than `2`

.

But why is this important? Well, it turns out that if you raise `2`

to `k`

number of times iff `k`

is a multiple of `4`

, you get a number ending in `6`

. This means that

$$ 2^{2^n} - 1 $$

Is divisible by `5`

! Why does this work? Well, first we need to look at two things. First, let’s watch what happens when we raise `2`

to `k`

.

$$ 2^4 = 2 * 2 * 2 * 2 = 4 * 2 * 2 = 8 * 2 = 16 $$

This sequence (`2 - 4 - 8 - 6`

) will repeat over and over again in the ones digit. Since this is multiplication, the tens digit can’t affect the ones digit, so this sequence must hold true for

$$ 2^{2^n} $$

as well.

Second, we realize that since the ones digit of this huge number is `6`

, the ones digit will be `5`

after `1`

is subtracted out! And because the number ends in `5`

, the number falls under the divisibility rule for `5`

and thus we conclude this number is not prime.