Files
freeCodeCamp/curriculum/challenges/ukrainian/10-coding-interview-prep/project-euler/problem-157-solving-the-diophantine-equation.md
2022-04-11 19:34:39 +05:30

48 lines
1.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
id: 5900f4091000cf542c50ff1c
title: 'Завдання 157: Розв''язування діофантових рівнянь'
challengeType: 5
forumTopicId: 301788
dashedName: problem-157-solving-the-diophantine-equation
---
# --description--
Розглянемо діофантові рівняння $\frac{1}{a} + \frac{1}{b} = \frac{p}{{10}^n}$ де $a$, $b$, $p$, $n$ — додатні цілі числа, а $a ≤ b$.
Якщо $n = 1$ дане рівняння має 20 розв'язків, показаних нижче:
$$\begin{array}{lllll} \frac{1}{1} + \frac{1}{1} = \frac{20}{10} & \frac{1}{1} + \frac{1}{2} = \frac{15}{10} & \frac{1}{1} + \frac{1}{5} = \frac{12}{10} & \frac{1}{1} + \frac{1}{10} = \frac{11}{10} & \frac{1}{2} + \frac{1}{2} = \frac{10}{10} \\\\
\frac{1}{2} + \frac{1}{5} = \frac{7}{10} & \frac{1}{2} + \frac{1}{10} = \frac{6}{10} & \frac{1}{3} + \frac{1}{6} = \frac{5}{10} & \frac{1}{3} + \frac{1}{15} = \frac{4}{10} & \frac{1}{4} + \frac{1}{4} = \frac{5}{10} \\\\
\frac{1}{4} + \frac{1}{4} = \frac{5}{10} & \frac{1}{5} + \frac{1}{5} = \frac{4}{10} & \frac{1}{5} + \frac{1}{10} = \frac{3}{10} & \frac{1}{6} + \frac{1}{30} = \frac{2}{10} & \frac{1}{10} + \frac{1}{10} = \frac{2}{10} \\\\
\frac{1}{11} + \frac{1}{110} = \frac{1}{10} & \frac{1}{12} + \frac{1}{60} = \frac{1}{10} & \frac{1}{14} + \frac{1}{35} = \frac{1}{10} & \frac{1}{15} + \frac{1}{30} = \frac{1}{10} & \frac{1}{20} + \frac{1}{20} = \frac{1}{10} \end{array}$$
Скільки розв'язків має це рівняння, якщо $1 ≤ n 9$?
# --hints--
`diophantineEquation()` має повертати `53490`.
```js
assert.strictEqual(diophantineEquation(), 53490);
```
# --seed--
## --seed-contents--
```js
function diophantineEquation() {
return true;
}
diophantineEquation();
```
# --solutions--
```js
// solution required
```