Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Post History

66%
+2 −0
#2: Post edited by user avatar Moshi‭ · 2020-10-24T01:27:32Z (about 4 years ago)
fixed some typoes
  • 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 by user avatar Moshi‭ · 2020-10-22T19:46:38Z (about 4 years ago)
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.