2018-09-30 23:01:58 +01:00
---
id: 5900f49d1000cf542c50ffb0
title: 'Problem 305: Reflexive Position'
2020-11-27 19:02:05 +01:00
challengeType: 5
2019-08-05 09:17:33 -07:00
forumTopicId: 301959
2021-01-13 03:31:00 +01:00
dashedName: problem-305-reflexive-position
2018-09-30 23:01:58 +01:00
---
2020-11-27 19:02:05 +01:00
# --description--
2018-09-30 23:01:58 +01:00
2021-07-21 17:59:56 +02:00
Let's call $S$ the (infinite) string that is made by concatenating the consecutive positive integers (starting from 1) written down in base 10.
2018-09-30 23:01:58 +01:00
2021-07-21 17:59:56 +02:00
Thus, $S = 1234567891011121314151617181920212223242\ldots$
2018-09-30 23:01:58 +01:00
2021-07-21 17:59:56 +02:00
It's easy to see that any number will show up an infinite number of times in $S$.
2018-09-30 23:01:58 +01:00
2021-07-21 17:59:56 +02:00
Let's call $f(n)$ the starting position of the $n^{\text{th}}$ occurrence of $n$ in $S$. For example, $f(1) = 1$, $f(5) = 81$, $f(12) = 271$ and $f(7780) = 111\\,111\\,365$.
2018-09-30 23:01:58 +01:00
2021-07-21 17:59:56 +02:00
Find $\sum f(3^k) for 1 ≤ k ≤ 13$.
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
# --hints--
2018-09-30 23:01:58 +01:00
2021-07-21 17:59:56 +02:00
`reflexivePosition()` should return `18174995535140` .
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
```js
2021-07-21 17:59:56 +02:00
assert.strictEqual(reflexivePosition(), 18174995535140);
2018-09-30 23:01:58 +01:00
```
2020-11-27 19:02:05 +01:00
# --seed--
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
## --seed-contents--
2018-09-30 23:01:58 +01:00
```js
2021-07-21 17:59:56 +02:00
function reflexivePosition() {
2020-09-15 09:57:40 -07:00
2018-09-30 23:01:58 +01:00
return true;
}
2021-07-21 17:59:56 +02:00
reflexivePosition();
2018-09-30 23:01:58 +01:00
```
2020-11-27 19:02:05 +01:00
# --solutions--
2018-09-30 23:01:58 +01:00
```js
// solution required
```