69 lines
1.1 KiB
Markdown
69 lines
1.1 KiB
Markdown
|
---
|
||
|
id: 5900f49d1000cf542c50ffb0
|
||
|
challengeType: 5
|
||
|
title: 'Problem 305: Reflexive Position'
|
||
|
forumTopicId: 301959
|
||
|
---
|
||
|
|
||
|
## Description
|
||
|
<section id='description'>
|
||
|
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...
|
||
|
|
||
|
|
||
|
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 nth occurrence of n in S.
|
||
|
For example, f(1)=1, f(5)=81, f(12)=271 and f(7780)=111111365.
|
||
|
|
||
|
|
||
|
Find ∑f(3k) for 1≤k≤13.
|
||
|
</section>
|
||
|
|
||
|
## Instructions
|
||
|
<section id='instructions'>
|
||
|
|
||
|
</section>
|
||
|
|
||
|
## Tests
|
||
|
<section id='tests'>
|
||
|
|
||
|
```yml
|
||
|
tests:
|
||
|
- text: <code>euler305()</code> should return 18174995535140.
|
||
|
testString: assert.strictEqual(euler305(), 18174995535140);
|
||
|
|
||
|
```
|
||
|
|
||
|
</section>
|
||
|
|
||
|
## Challenge Seed
|
||
|
<section id='challengeSeed'>
|
||
|
|
||
|
<div id='js-seed'>
|
||
|
|
||
|
```js
|
||
|
function euler305() {
|
||
|
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
euler305();
|
||
|
```
|
||
|
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
</section>
|
||
|
|
||
|
## Solution
|
||
|
<section id='solution'>
|
||
|
|
||
|
```js
|
||
|
// solution required
|
||
|
```
|
||
|
|
||
|
</section>
|