$N$th Digit of Reciprocals

Let $d_n(x)$ be the $n$th decimal digit of the fractional part of $x$, or $0$ if the fractional part has fewer than $n$ digits.
For example:

$d_7 \mathopen{}\left( 1 \right)\mathclose{} = d_7 \mathopen{}\left( \frac 1 2 \right)\mathclose{} = d_7 \mathopen{}\left( \frac 1 4 \right)\mathclose{} = d_7 \mathopen{}\left( \frac 1 5 \right)\mathclose{} = 0$
$d_7 \mathopen{}\left( \frac 1 3 \right)\mathclose{} = 3$ since $\frac 1 3 =$ 0.3333333333…
$d_7 \mathopen{}\left( \frac 1 6 \right)\mathclose{} = 6$ since $\frac 1 6 =$ 0.1666666666…
$d_7 \mathopen{}\left( \frac 1 7 \right)\mathclose{} = 1$ since $\frac 1 7 =$ 0.1428571428…

Let $\displaystyle S(n) = \sum_{k=1}^n d_n \mathopen{}\left( \frac 1 k \right)\mathclose{}$.
You are given:

$S(7) = 0 + 0 + 3 + 0 + 0 + 6 + 1 = 10$
$S(100) = 418$

Find $S(10^7)$.

To solve this problem, we need to make some observations about the nature of the decimal expansions of fractions.

1) If a fraction has a terminating decimal expansion, then all digits after some point will be 0’s, and thus not contribute to the sum for high enough $n$.

2) Not all fractions result in repeating decimals. Only fractions where the denominator is not of the form $2^a5^b$ do. In other words, only when the denominator has prime factors other than 2 and 5 does the fraction result in a repeating decimal.

3) If a fraction does have a repeating decimal expansion, it will eventually cycle through all digits from 1-9 if and only if the denominator is relatively prime to 10. Otherwise, the repeating part will consist only of multiples of the highest power of 2 or 5 dividing the denominator.

Using these observations, we can split S(n) into two cases:

i) Terms with $k$ having any prime factor other than 2 and 5 (namely, k= 1 or any prime greater than 5). These fractions will repeat after some point, and thus for large enough $n$, each digit after the decimal point appears with equal frequency. Hence, each of these fractions contribute $\frac{1+2+3+4+5+6+7+8+9}{9}=5$.

ii) Terms with $k$ being a power of 2 or 5, or twice a power of 5. These expand into a terminating decimal fraction, and so only contribute when their position in the sum is less or equal to the number of digits in their decimal expansion.

Consider the first 10 million terms in the sum. In the first i) category, there are $10^7-\pi(10^7)$ terms. Since $\pi(n) \approx \frac{n}{\log(n)}$, this is approximately $10^7 – \frac{10^7}{16} = \frac{15}{16} \cdot 10^7$.

In the ii) category, each fraction contributes its denominator as a summand when it appears. The powers of 2 less than $10^7$ are $2^1,2^2,2^3,…,2^{23}$, and their sum is $2^1+2^2+2^3+…+2^{23}=2^{24}-2=2^{23}\times 2-2\approx 8.4\times10^6$. The powers of 5 less than 10 million are $5^1,5^2,…,5^7$, and their sum is $5^1+5^2+…+5^7=5^7\times4/4=5^7\times 4\approx 6.3\times10^5$. The numbers of the form $2\times 5^k$ less than 10 million are $2\times5^1,2\times5^2,…,2\times5^6$, and their sum is $2\times(\frac{5^6 \cdot 4}{4}) = 2\times 5^6 \times 4\approx 5\times10^5$.

Hence, we approximate the sum S($10^7$) as $5\times (\frac{15}{16}\times 10^7+(8.4\times10^6)+(6.3\times10^5)+(5\times10^5))\approx250000000+42000000+3150000+2500000=277850000$, and then subtract an error term because the actual value will be slightly less than the approximation. This error term will probably be in the thousands or tens of thousands, so for a reasonably close answer, subtract somewhere in that ballpark, to approximately get the result $\boxed{277845000}$.

More Answers:
Digits in Squares
SET
Iterative Sampling

Share:

Recent Posts

Mathematics in Cancer Treatment

How Mathematics is Transforming Cancer Treatment Mathematics plays an increasingly vital role in the fight against cancer mesothelioma. From optimizing drug delivery systems to personalizing

Read More »