## Let’s call $S$ the (infinite) string that is made by concatenating the consecutive positive integers (starting from $1$) written down in base $10$.

Thus, $S = 1234567891011121314151617181920212223242\cdots$

It’s easy to see that any number will show up an infinite number of times in $S$.

Let’s call $f(n)$ the starting position of the $n$th occurrence of $n$ in $S$.

For example, $f(1)=1$, $f(5)=81$, $f(12)=271$ and $f(7780)=111111365$.

Find $\sum f(3^k)$ for $1 \le k \le 13$.

### The problem we are trying to solve involves a sequence of base-10 positive integers concatenated together, with each integer appearing infinitely throughout the sequence. We are looking for the starting position of each 3^k (where k ranges from 1 to 13) in this sequence, which we’ll denote as f(3^k). Then, we sum all these starting positions.

To begin, let’s define some terms. Suppose we are looking for the value of f(3^k). Let’s classify the 3^k into four groups based on the number of digits, d, in each number:

1) d <= 9 (The numbers from 3^1 to 3^6) 2) 10 <= d <= 99 (The number 3^7) 3) 100 <= d <= 999 (The number 3^8) 4) 1000 <= d <= 9999 (The numbers from 3^9 to 3^13) For group 1, each of these numbers appears at the beginning of 3^d places in the sequence. Therefore, the sum of these places is: f(3) + f(9) + f(27) + f(81) + f(243) + f(729) = 4*(3 + 3*10 + 3*100 + 3*1000 + 3*10000 + 3*100000) = 4*(333333) = 1,333,332 For group 2, the number 3^7 = 2187 starts at location 3 * 10^4 * 2 * 187 + 1, which equals 1,124,001. For group 3, the number 3^8 = 6561 starts at location 3 * 10^6 * 5 * 561 + 1, which equals 8,415,001. For the fourth group, all the numbers start at location 3 * 10^8 * d * X + 1 where X = 3^(k-8), and d = the number of digits in X. So the sum of these places is: f(19683) + f(59049) + f(177147) + f(531441) + f(1594323) = 3*10^8 *((4*19683) + (5*59049) + (5*177147) + (5*531441) + (5*1594323)) + 5 = 3*10^8 * 39217420 + 5 = 117,652,260,000,005. Finally, to get the total sum, add up the results from all four groups: Sum = 1,333,332 + 1,124,001 + 8,415,001 + 117,652,260,000,005 = 117,652,272,872,339.

##### More Answers:

Strong Achilles NumbersMultiples with Small Digits

Primonacci