Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com> Co-authored-by: Kristofer Koishigawa <scissorsneedfoodtoo@gmail.com> Co-authored-by: Beau Carnes <beaucarnes@gmail.com>
1.3 KiB
1.3 KiB
id, challengeType, isHidden, title, forumTopicId
id | challengeType | isHidden | title | forumTopicId |
---|---|---|---|---|
5900f4331000cf542c50ff45 | 5 | false | Problem 198: Ambiguous Numbers | 301836 |
Description
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 < x < 1/100, are there whose denominator q does not exceed 108?
Instructions
Tests
tests:
- text: <code>euler198()</code> should return 52374425.
testString: assert.strictEqual(euler198(), 52374425);
Challenge Seed
function euler198() {
// Good luck!
return true;
}
euler198();
Solution
// solution required