# It's the magic number!

Hey! In this note I'm going to talk about a very cool pattern... in the case of 3, observe the sequence below:

$\displaystyle { P }_{ 0 }=3\\ { P }_{ 1 }={ 3 }^{ { P }_{ 0 } }=27\\ { P }_{ 2 }={ 3 }^{ { P }_{ 1 } }=...84987\\ { P }_{ 3 }={ 3 }^{ { P }_{ 2 } }=...39387\\ { P }_{ 4 }={ 3 }^{ { P }_{ 3 } }=...55387\\ { P }_{ 5 }={ 3 }^{ { P }_{ 4 } }=...95387\\ { P }_{ 6 }={ 3 }^{ { P }_{ 5 } }=...95387$

Notice that the digits at the end stay the same! In fact, we add one "fixed" digit every time. The cool part is that this works for every natural number coprime to 1000 - which also implies it works for any prime greater than 5, and that this works 40% of the time! ($\phi(1000)=400$) In this note I'm only covering the special case where ${P}_{k}$ has $k$ fixed digits -- there are other cases, such as when you use 5, that grow far more quickly.

The first step is to show that if $a$ is coprime to 1000 then

$\displaystyle {a}^{100} \equiv 1 \pmod {1000}$

This is justified because $\lambda(1000)=100$, where $\lambda(n)$ is the Carmichael function which gives the minimum value (for where 100 is) for the equation above. Now, let ${a}^{100}=1000b+1$. Let's compute ${a}^{1000}$:

$\displaystyle {\left(1000b+1\right)}^{10} = \binom{ 10 }{ 10 }+\binom{ 10 }{ 9 }1000b...$

We now have that ${a}^{1000} \equiv 1 \pmod {10000}$, and we can induct to show that ${a}^{{10}^{n}} \equiv 1 \pmod {{10}^{n+1}}$.

In this section I'll use $j$ as a number coprime to 1000. Let ${D}_{n}$ be the ${n}^{th}$ digit of ${P}_{k}$, and let $d$ be the number of digits in ${P}_{k}$. Observe that

$\displaystyle { P }_{ k+1 }=\prod _{ i=1 }^{ d }{ { j }^{ { 10 }^{ d-i }{ D }_{ d-i } } }$

Using our previous result, if we evaluate mod ${10}^{k+1}$, a lot of terms will just become 1 and can be ignored. So we get a new product:

$\displaystyle { P }_{ k+1 }=\prod _{ i=1 }^{ k }{ { j }^{ { 10 }^{ k-i }{ D }_{ k-i } } } \pmod {{ 10 }^{ k+1 }}$

Okay, so really we only care about the last $k$ digits of ${P}_{k}$ if we're finding the last $k+1$ digits of ${P}_{k+1}$. (Specifically we raise j to ${P}_{k}$ in mod ${10}^{k}$)

Now I can prove the conjecture about the last digits (by induction). The base case is easy, so I'll leap right into showing that the next ${P}_{k+1}$ has $k+1$ fixed digits.

First, we assume that the last $k$ digits of ${P}_{k}$ are fixed. This means we only need to show that we add another fixed digit in ${P}_{k+1}$. For this part, let $a \equiv {P}_{k} \pmod {{10}^{k}}$ and let $b$ be the $k+{1}^{th}$ digit from the end of ${P}_{k+1}$. We want to show that:

$\displaystyle { j }^{ { 10 }^{ k }b+a }\equiv { 10 }^{ k }b+a \pmod {{10}^{k+1}}$

which essentially says that the last $k+1$ digits of ${P}_{k}$ will be the last $k+1$ digits of all later terms in the series. The two finds I made earlier make this very easy:

$\displaystyle { \left( { j }^{ { 10 }^{ k } } \right) }^{ b }{ j }^{ a }\equiv { 10 }^{ k }b+a{ \pmod { 10 }^{ k+1 } }$

which we may reduce to

$\displaystyle { j }^{ a }\equiv { 10 }^{ k }b+a{ \pmod { 10 }^{ k+1 } }$

We know from earlier that ${j}^{a}$ will give ${P}_{k+1} \pmod {{10}^{k+1}}$, and by definition ${P}_{k+1} \equiv {10}^{k}b+a \pmod {{10}^{k+1}}$. Thus the statement we started with is true, and we're done!

Please comment if you have any questions/concerns or any further ideas!

Note by Dylan Pentland
6 years ago

This discussion board is a place to discuss our Daily Challenges and the math and science related to those challenges. Explanations are more than just a solution — they should explain the steps and thinking strategies that you used to obtain the solution. Comments should further the discussion of math and science.

When posting on Brilliant:

• Use the emojis to react to an explanation, whether you're congratulating a job well done , or just really confused .
• Ask specific questions about the challenge or the steps in somebody's explanation. Well-posed questions can add a lot to the discussion, but posting "I don't understand!" doesn't help anyone.
• Try to contribute something new to the discussion, whether it is an extension, generalization or other idea related to the challenge.
• Stay on topic — we're all here to learn more about math and science, not to hear about your favorite get-rich-quick scheme or current world events.

MarkdownAppears as
*italics* or _italics_ italics
**bold** or __bold__ bold
- bulleted- list
• bulleted
• list
1. numbered2. list
1. numbered
2. list
Note: you must add a full line of space before and after lists for them to show up correctly
paragraph 1paragraph 2

paragraph 1

paragraph 2

[example link](https://brilliant.org)example link
> This is a quote
This is a quote
    # I indented these lines
# 4 spaces, and now they show
# up as a code block.

print "hello world"
# I indented these lines
# 4 spaces, and now they show
# up as a code block.

print "hello world"
MathAppears as
Remember to wrap math in $$ ... $$ or $ ... $ to ensure proper formatting.
2 \times 3 $2 \times 3$
2^{34} $2^{34}$
a_{i-1} $a_{i-1}$
\frac{2}{3} $\frac{2}{3}$
\sqrt{2} $\sqrt{2}$
\sum_{i=1}^3 $\sum_{i=1}^3$
\sin \theta $\sin \theta$
\boxed{123} $\boxed{123}$

## Comments

Sort by:

Top Newest

yo

- 5 years, 11 months ago

Log in to reply

I used your note as an inspiration fore one of my Problems. Thanks! Basically, it's about your $P_2$ and $P_3$ in the even case.... when do they end with the same digit? You have probably thought about this already...

- 6 years ago

Log in to reply

I think there is a typo you said let a^100=1000b+1 and then took a^1000=(1000b+1)^1000.

- 6 years ago

Log in to reply

Yeah, I meant to raise it to the 10th. But, the proof still works :)

- 6 years ago

Log in to reply

Ya worked.BTW great work.Keep it up. xD

- 6 years ago

Log in to reply

Yes, this makes good sense! Beautiful!

That's how I think of it: For the Carmichael Lambda we have $\lambda(10^m)|10^{m-1}$ for $m\geq{3}$ . Also, $\lambda(100)=20,\lambda(20)=4$ and $\lambda(4)=2$.

Thus, for an odd integer $a$, we can "work our way up" as follows: $a\equiv1\pmod2$ , so $a^a\equiv a \pmod4$ so $a^{a^a}\equiv{a^a}\pmod{20}$ so $a^{a^{a^a}}\equiv{a^{a^a}}\pmod{100}$ and $^{m+1}a\equiv{^m{a}}\pmod{10^{m-1}}$ for all positive integers $m$.

- 6 years ago

Log in to reply

Cool! Do you have any ideas on how the resulting series of fixed digits could be found? I'm trying to find some patterns in them but haven't found anything yet...

- 6 years ago

Log in to reply

I'm sure you will figure it out ;) Enjoy!

- 6 years ago

Log in to reply

This looks interesting! Thank you for sharing!

It is not hard to see that, for any two positive integers $b$ and $n$, the "power tower" $^m{b}=b^{b^{b^{...}}}$ eventually becomes stationary modulo $n$. We can prove this by induction on $n$; let's assume the claim to be true for integers $ . Then the exponent $^{m-1}b$ of our power tower will eventually become stationary modulo $\phi(n)$ , so that the whole tower will become stationary modulo $n$ by Euler's Theorem.

In your article, you quantify the "eventually" part of this statement in some cases... I look forward to studying the details when I have some free time.

- 6 years ago

Log in to reply

×

Problem Loading...

Note Loading...

Set Loading...