Files
freeCodeCamp/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-157-solving-the-diophantine-equation.md
gikf bfc21e4c40 fix(curriculum): clean-up Project Euler 141-160 (#42750)
* fix: clean-up Project Euler 141-160

* fix: corrections from review

Co-authored-by: Sem Bauke <46919888+Sembauke@users.noreply.github.com>

* fix: corrections from review

Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>

* fix: use different notation for consistency

* Update curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-144-investigating-multiple-reflections-of-a-laser-beam.md

Co-authored-by: gikf <60067306+gikf@users.noreply.github.com>

Co-authored-by: Sem Bauke <46919888+Sembauke@users.noreply.github.com>
Co-authored-by: Tom <20648924+moT01@users.noreply.github.com>
2021-07-14 13:05:12 +02:00

58 lines
1.7 KiB
Markdown

---
id: 5900f4091000cf542c50ff1c
title: 'Problem 157: Solving the diophantine equation'
challengeType: 5
forumTopicId: 301788
dashedName: problem-157-solving-the-diophantine-equation
---
# --description--
Consider the diophantine equation $\frac{1}{a} + \frac{1}{b} = \frac{p}{{10}^n}$ with $a$, $b$, $p$, $n$ positive integers and $a ≤ b$.
For $n = 1$ this equation has 20 solutions that are listed below:
$$\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}$$
How many solutions has this equation for $1 ≤ n ≤ 9$?
# --hints--
`diophantineEquation()` should return `53490`.
```js
assert.strictEqual(diophantineEquation(), 53490);
```
# --seed--
## --seed-contents--
```js
function diophantineEquation() {
return true;
}
diophantineEquation();
```
# --solutions--
```js
// solution required
```