2018-09-30 23:01:58 +01:00
---
id: 5900f50a1000cf542c51001c
title: 'Problem 413: One-child Numbers'
2020-11-27 19:02:05 +01:00
challengeType: 5
2019-08-05 09:17:33 -07:00
forumTopicId: 302082
2021-01-13 03:31:00 +01:00
dashedName: problem-413-one-child-numbers
2018-09-30 23:01:58 +01:00
---
2020-11-27 19:02:05 +01:00
# --description--
2021-07-29 19:48:24 +02:00
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$.
2018-09-30 23:01:58 +01:00
2021-07-29 19:48:24 +02:00
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.
2018-09-30 23:01:58 +01:00
2021-07-29 19:48:24 +02:00
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.
2018-09-30 23:01:58 +01:00
2021-07-29 19:48:24 +02:00
Let $F(N)$ be the number of the one-child numbers less than $N$. We can verify that $F(10) = 9$, $F({10}^3) = 389$ and $F({10}^7) = 277\\,674$.
Find $F({10}^{19})$.
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-29 19:48:24 +02:00
`oneChildNumbers()` should return `3079418648040719` .
2018-09-30 23:01:58 +01:00
2020-11-27 19:02:05 +01:00
```js
2021-07-29 19:48:24 +02:00
assert.strictEqual(oneChildNumbers(), 3079418648040719);
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-29 19:48:24 +02:00
function oneChildNumbers() {
2020-09-15 09:57:40 -07:00
2018-09-30 23:01:58 +01:00
return true;
}
2021-07-29 19:48:24 +02:00
oneChildNumbers();
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
```