2018-09-30 22:01:58 +00:00
|
|
|
---
|
|
|
|
id: 5900f50a1000cf542c51001c
|
|
|
|
challengeType: 5
|
|
|
|
title: 'Problem 413: One-child Numbers'
|
|
|
|
---
|
|
|
|
|
|
|
|
## Description
|
|
|
|
<section id='description'>
|
|
|
|
We say that a d-digit positive number (no leading zeros) is a one-child number if exactly one of its sub-strings is divisible by d.
|
|
|
|
|
|
|
|
For example, 5671 is a 4-digit one-child number. Among all its sub-strings 5, 6, 7, 1, 56, 67, 71, 567, 671 and 5671, only 56 is divisible by 4.
|
|
|
|
Similarly, 104 is a 3-digit one-child number because only 0 is divisible by 3.
|
|
|
|
1132451 is a 7-digit one-child number because only 245 is divisible by 7.
|
|
|
|
|
|
|
|
Let F(N) be the number of the one-child numbers less than N.
|
|
|
|
We can verify that F(10) = 9, F(103) = 389 and F(107) = 277674.
|
|
|
|
|
|
|
|
Find F(1019).
|
|
|
|
</section>
|
|
|
|
|
|
|
|
## Instructions
|
|
|
|
<section id='instructions'>
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
## Tests
|
|
|
|
<section id='tests'>
|
|
|
|
|
|
|
|
```yml
|
2018-10-04 13:37:37 +00:00
|
|
|
tests:
|
|
|
|
- text: <code>euler413()</code> should return 3079418648040719.
|
2018-10-20 18:02:47 +00:00
|
|
|
testString: assert.strictEqual(euler413(), 3079418648040719, '<code>euler413()</code> should return 3079418648040719.');
|
2018-09-30 22:01:58 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
## Challenge Seed
|
|
|
|
<section id='challengeSeed'>
|
|
|
|
|
|
|
|
<div id='js-seed'>
|
|
|
|
|
|
|
|
```js
|
|
|
|
function euler413() {
|
|
|
|
// Good luck!
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
euler413();
|
|
|
|
```
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
## Solution
|
|
|
|
<section id='solution'>
|
|
|
|
|
|
|
|
```js
|
|
|
|
// solution required
|
|
|
|
```
|
|
|
|
</section>
|