Post History
#2: Post edited
- I was pretty curious about this, so I posted a question on [Math.SE](https://math.stackexchange.com/questions/3876136/do-the-digits-of-sum-k-0n20k-repeat). Most of this answer will draw from the idea of J. W. Tanner's answer there.
- ---
- There is actually a simple reason why this pattern holds.
- Lets start by examining how the digits are generated: each digit is a power of two (with carrying). We can withhold decimal shifting for a second and simply look at a simplified expression with the same digits, only generated to the left of the decimal point:
- $$
\begin{aligned}\sum_{k=0}^{n-1} 2^k\cdot 10^k&=1+20+400+16000+320000+\cdots+2^k\cdot10^k\\\ &=\cdots7368421\end{aligned}- $$
You can see how the pattern generated is the same. Lets look at it another way, using the geomatric series formula.- $$
- \begin{aligned}\sum_{k=0}^{n-1} 2^k\cdot10^k&=\frac{1(1-20^n)}{1-20}\\\ &=\frac{20^n-1}{19}\end{aligned}
- $$
- At this point, it's pretty clear why the digits generated become the repeated decimal of $1/19$. You can see the denominator of $19$ right there!
- ---
- If you're not satisfied with that observation, we can further note the following:
- $$
- \begin{aligned}\frac{20^n-1}{19}&=\frac{20^n}{19}-\frac{1}{19}\\\ &=\frac{2^n}{19}\cdot10^n-\frac{1}{19}\end{aligned}
- $$
- Let's specifically focus on $2^n/19$. Since we are interested in repeated groups of digits, let's let $n$ be a multiple of the totient of $19$, which is $18$. The reason we chose the totient is because of a useful property of modular arithmetic: $a^b\equiv 1\mod c$ if $a$ and $c$ are coprime and $b$ is a multiple of the totient of $c$ (Euler's theorem).
- Clearly, $2$ is coprime to $19$, so letting $n$ be a multiple of $18$ gives us a remainder of 1 when dividing $2^n$ by $19$. Therefore, the digits after the decimal point of $2^n/19$ are the same as the digits of $1/19$.
- Going back to the whole expression, we then multiply by $10^n$, bringing $n$ of those repeated digits over to the *left* of the decimal point. Everything to the *right* is canceled by the subtraction of $1/19$ (the digits must cancel, since the expression is an integer).
- The result is the final number has its last $n$ digits be the first $n$ digits of $1/19$ when $n$ is a multiple of $18$, which is what we wanted to prove. (It's not difficult to generalize this for any $n$, but that's beyond this answer).
- ---
- A similar result can be produced for any $10c-1$, where the digits will repeat every totient of $10c-1$ (though it may repeat before that) and the repeating portion will be the same as the digits of $1/(10c-1)$. Since it's basically the same process, I won't repeat it here.
- I was pretty curious about this, so I posted a question on [Math.SE](https://math.stackexchange.com/questions/3876136/do-the-digits-of-sum-k-0n20k-repeat). Most of this answer will draw from the idea of J. W. Tanner's answer there.
- ---
- There is actually a simple reason why this pattern holds.
- Lets start by examining how the digits are generated: each digit is a power of two (with carrying). We can withhold decimal shifting for a second and simply look at a simplified expression with the same digits, only generated to the left of the decimal point:
- $$
- \begin{aligned}\sum_{k=0}^{n-1} 2^k\cdot 10^k&=1+20+400+16000+320000+\cdots+2^{n-1}\cdot10^{n-1}\\\ &=\cdots7368421\end{aligned}
- $$
- You can see how the pattern generated is the same. Let's look at it another way, using the geometric series formula.
- $$
- \begin{aligned}\sum_{k=0}^{n-1} 2^k\cdot10^k&=\frac{1(1-20^n)}{1-20}\\\ &=\frac{20^n-1}{19}\end{aligned}
- $$
- At this point, it's pretty clear why the digits generated become the repeated decimal of $1/19$. You can see the denominator of $19$ right there!
- ---
- If you're not satisfied with that observation, we can further note the following:
- $$
- \begin{aligned}\frac{20^n-1}{19}&=\frac{20^n}{19}-\frac{1}{19}\\\ &=\frac{2^n}{19}\cdot10^n-\frac{1}{19}\end{aligned}
- $$
- Let's specifically focus on $2^n/19$. Since we are interested in repeated groups of digits, let's let $n$ be a multiple of the totient of $19$, which is $18$. The reason we chose the totient is because of a useful property of modular arithmetic: $a^b\equiv 1\mod c$ if $a$ and $c$ are coprime and $b$ is a multiple of the totient of $c$ (Euler's theorem).
- Clearly, $2$ is coprime to $19$, so letting $n$ be a multiple of $18$ gives us a remainder of 1 when dividing $2^n$ by $19$. Therefore, the digits after the decimal point of $2^n/19$ are the same as the digits of $1/19$.
- Going back to the whole expression, we then multiply by $10^n$, bringing $n$ of those repeated digits over to the *left* of the decimal point. Everything to the *right* is canceled by the subtraction of $1/19$ (the digits must cancel, since the expression is an integer).
- The result is the final number has its last $n$ digits be the first $n$ digits of $1/19$ when $n$ is a multiple of $18$, which is what we wanted to prove. (It's not difficult to generalize this for any $n$, but that's beyond this answer).
- ---
- A similar result can be produced for any $10c-1$, where the digits will repeat every totient of $10c-1$ (though it may repeat before that) and the repeating portion will be the same as the digits of $1/(10c-1)$. Since it's basically the same process, I won't repeat it here.
#1: Initial revision
I was pretty curious about this, so I posted a question on [Math.SE](https://math.stackexchange.com/questions/3876136/do-the-digits-of-sum-k-0n20k-repeat). Most of this answer will draw from the idea of J. W. Tanner's answer there. --- There is actually a simple reason why this pattern holds. Lets start by examining how the digits are generated: each digit is a power of two (with carrying). We can withhold decimal shifting for a second and simply look at a simplified expression with the same digits, only generated to the left of the decimal point: $$ \begin{aligned}\sum_{k=0}^{n-1} 2^k\cdot 10^k&=1+20+400+16000+320000+\cdots+2^k\cdot10^k\\\ &=\cdots7368421\end{aligned} $$ You can see how the pattern generated is the same. Lets look at it another way, using the geomatric series formula. $$ \begin{aligned}\sum_{k=0}^{n-1} 2^k\cdot10^k&=\frac{1(1-20^n)}{1-20}\\\ &=\frac{20^n-1}{19}\end{aligned} $$ At this point, it's pretty clear why the digits generated become the repeated decimal of $1/19$. You can see the denominator of $19$ right there! --- If you're not satisfied with that observation, we can further note the following: $$ \begin{aligned}\frac{20^n-1}{19}&=\frac{20^n}{19}-\frac{1}{19}\\\ &=\frac{2^n}{19}\cdot10^n-\frac{1}{19}\end{aligned} $$ Let's specifically focus on $2^n/19$. Since we are interested in repeated groups of digits, let's let $n$ be a multiple of the totient of $19$, which is $18$. The reason we chose the totient is because of a useful property of modular arithmetic: $a^b\equiv 1\mod c$ if $a$ and $c$ are coprime and $b$ is a multiple of the totient of $c$ (Euler's theorem). Clearly, $2$ is coprime to $19$, so letting $n$ be a multiple of $18$ gives us a remainder of 1 when dividing $2^n$ by $19$. Therefore, the digits after the decimal point of $2^n/19$ are the same as the digits of $1/19$. Going back to the whole expression, we then multiply by $10^n$, bringing $n$ of those repeated digits over to the *left* of the decimal point. Everything to the *right* is canceled by the subtraction of $1/19$ (the digits must cancel, since the expression is an integer). The result is the final number has its last $n$ digits be the first $n$ digits of $1/19$ when $n$ is a multiple of $18$, which is what we wanted to prove. (It's not difficult to generalize this for any $n$, but that's beyond this answer). --- A similar result can be produced for any $10c-1$, where the digits will repeat every totient of $10c-1$ (though it may repeat before that) and the repeating portion will be the same as the digits of $1/(10c-1)$. Since it's basically the same process, I won't repeat it here.