2018-09-30 22:01:58 +00:00
|
|
|
---
|
|
|
|
id: 5900f49d1000cf542c50ffb0
|
|
|
|
title: 'Problem 305: Reflexive Position'
|
2020-11-27 18:02:05 +00:00
|
|
|
challengeType: 5
|
2019-08-05 16:17:33 +00:00
|
|
|
forumTopicId: 301959
|
2021-01-13 02:31:00 +00:00
|
|
|
dashedName: problem-305-reflexive-position
|
2018-09-30 22:01:58 +00:00
|
|
|
---
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
# --description--
|
2018-09-30 22:01:58 +00:00
|
|
|
|
2020-11-27 18:02:05 +00: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 22:01:58 +00:00
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
Thus, S = 1234567891011121314151617181920212223242...
|
2018-09-30 22:01:58 +00:00
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
It's easy to see that any number will show up an infinite number of times in S.
|
2018-09-30 22:01:58 +00:00
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
Let's call f(n) the starting position of the nth occurrence of n in S. For example, f(1)=1, f(5)=81, f(12)=271 and f(7780)=111111365.
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
|
|
Find ∑f(3k) for 1≤k≤13.
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
# --hints--
|
2018-09-30 22:01:58 +00:00
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
`euler305()` should return 18174995535140.
|
2018-09-30 22:01:58 +00:00
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
```js
|
|
|
|
assert.strictEqual(euler305(), 18174995535140);
|
2018-09-30 22:01:58 +00:00
|
|
|
```
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
# --seed--
|
2018-09-30 22:01:58 +00:00
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
## --seed-contents--
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
|
|
```js
|
|
|
|
function euler305() {
|
2020-09-15 16:57:40 +00:00
|
|
|
|
2018-09-30 22:01:58 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
euler305();
|
|
|
|
```
|
|
|
|
|
2020-11-27 18:02:05 +00:00
|
|
|
# --solutions--
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
|
|
```js
|
|
|
|
// solution required
|
|
|
|
```
|