Files
freeCodeCamp/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-198-ambiguous-numbers.md
Oliver Eyton-Williams ee1e8abd87 feat(curriculum): restore seed + solution to Chinese (#40683)
* feat(tools): add seed/solution restore script

* chore(curriculum): remove empty sections' markers

* chore(curriculum): add seed + solution to Chinese

* chore: remove old formatter

* fix: update getChallenges

parse translated challenges separately, without reference to the source

* chore(curriculum): add dashedName to English

* chore(curriculum): add dashedName to Chinese

* refactor: remove unused challenge property 'name'

* fix: relax dashedName requirement

* fix: stray tag

Remove stray `pre` tag from challenge file.

Signed-off-by: nhcarrigan <nhcarrigan@gmail.com>

Co-authored-by: nhcarrigan <nhcarrigan@gmail.com>
2021-01-12 19:31:00 -07:00

43 lines
1.1 KiB
Markdown

---
id: 5900f4331000cf542c50ff45
title: 'Problem 198: Ambiguous Numbers'
challengeType: 5
forumTopicId: 301836
dashedName: problem-198-ambiguous-numbers
---
# --description--
A best approximation to a real number x for the denominator bound d is a rational number r/s (in reduced form) with s ≤ d, so that any rational number p/q which is closer to x than r/s has q > d.
Usually the best approximation to a real number is uniquely determined for all denominator bounds. However, there are some exceptions, e.g. 9/40 has the two best approximations 1/4 and 1/5 for the denominator bound 6. We shall call a real number x ambiguous, if there is at least one denominator bound for which x possesses two best approximations. Clearly, an ambiguous number is necessarily rational.
How many ambiguous numbers x = p/q, 0 &lt; x &lt; 1/100, are there whose denominator q does not exceed 108?
# --hints--
`euler198()` should return 52374425.
```js
assert.strictEqual(euler198(), 52374425);
```
# --seed--
## --seed-contents--
```js
function euler198() {
return true;
}
euler198();
```
# --solutions--
```js
// solution required
```