Feat: add new Markdown parser (#39800)
and change all the challenges to new `md` format.
This commit is contained in:
committed by
GitHub
parent
a07f84c8ec
commit
0bd52f8bd1
@ -1,60 +1,51 @@
|
||||
---
|
||||
id: 5900f3b11000cf542c50fec4
|
||||
challengeType: 5
|
||||
title: 'Problem 69: Totient maximum'
|
||||
challengeType: 5
|
||||
forumTopicId: 302181
|
||||
---
|
||||
|
||||
## Description
|
||||
<section id='description'>
|
||||
# --description--
|
||||
|
||||
Euler's Totient function, φ(<var>n</var>) [sometimes called the phi function], is used to determine the number of numbers less than <var>n</var> which are relatively prime to <var>n</var>. For example, as 1, 2, 4, 5, 7, and 8, are all less than nine and relatively prime to nine, φ(9)=6.
|
||||
Euler's Totient function, φ(`n`) \[sometimes called the phi function], is used to determine the number of numbers less than `n` which are relatively prime to `n`. For example, as 1, 2, 4, 5, 7, and 8, are all less than nine and relatively prime to nine, φ(9)=6.
|
||||
|
||||
<div style='margin-left: 4em;'>
|
||||
|
||||
|<var>n</var>|Relatively Prime|φ(<var>n</var>)|<var>n</var>/φ(<var>n</var>)|
|
||||
|--- |--- |--- |--- |
|
||||
|2|1|1|2|
|
||||
|3|1,2|2|1.5|
|
||||
|4|1,3|2|2|
|
||||
|5|1,2,3,4|4|1.25|
|
||||
|6|1,5|2|3|
|
||||
|7|1,2,3,4,5,6|6|1.1666...|
|
||||
|8|1,3,5,7|4|2|
|
||||
|9|1,2,4,5,7,8|6|1.5|
|
||||
|10|1,3,7,9|4|2.5|
|
||||
| <var>n</var> | Relatively Prime | φ(<var>n</var>) | <var>n</var>/φ(<var>n</var>) |
|
||||
| ------------ | ---------------- | --------------- | ---------------------------- |
|
||||
| 2 | 1 | 1 | 2 |
|
||||
| 3 | 1,2 | 2 | 1.5 |
|
||||
| 4 | 1,3 | 2 | 2 |
|
||||
| 5 | 1,2,3,4 | 4 | 1.25 |
|
||||
| 6 | 1,5 | 2 | 3 |
|
||||
| 7 | 1,2,3,4,5,6 | 6 | 1.1666... |
|
||||
| 8 | 1,3,5,7 | 4 | 2 |
|
||||
| 9 | 1,2,4,5,7,8 | 6 | 1.5 |
|
||||
| 10 | 1,3,7,9 | 4 | 2.5 |
|
||||
|
||||
</div>
|
||||
|
||||
It can be seen that <var>n</var>=6 produces a maximum <var>n</var>/φ(<var>n</var>) for <var>n</var> ≤ 10.
|
||||
It can be seen that `n`=6 produces a maximum `n`/φ(`n`) for `n` ≤ 10.
|
||||
|
||||
Find the value of <var>n</var> ≤ 1,000,000 for which n/φ(<var>n</var>) is a maximum.
|
||||
Find the value of `n` ≤ 1,000,000 for which n/φ(`n`) is a maximum.
|
||||
|
||||
</section>
|
||||
# --hints--
|
||||
|
||||
## Instructions
|
||||
<section id='instructions'>
|
||||
|
||||
</section>
|
||||
|
||||
## Tests
|
||||
<section id='tests'>
|
||||
|
||||
```yml
|
||||
tests:
|
||||
- text: <code>totientMaximum()</code> should return a number.
|
||||
testString: assert(typeof totientMaximum() === 'number');
|
||||
- text: <code>totientMaximum()</code> should return 510510.
|
||||
testString: assert.strictEqual(totientMaximum(), 510510);
|
||||
`totientMaximum()` should return a number.
|
||||
|
||||
```js
|
||||
assert(typeof totientMaximum() === 'number');
|
||||
```
|
||||
|
||||
</section>
|
||||
`totientMaximum()` should return 510510.
|
||||
|
||||
## Challenge Seed
|
||||
<section id='challengeSeed'>
|
||||
```js
|
||||
assert.strictEqual(totientMaximum(), 510510);
|
||||
```
|
||||
|
||||
<div id='js-seed'>
|
||||
# --seed--
|
||||
|
||||
## --seed-contents--
|
||||
|
||||
```js
|
||||
function totientMaximum() {
|
||||
@ -65,17 +56,8 @@ function totientMaximum() {
|
||||
totientMaximum();
|
||||
```
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
</section>
|
||||
|
||||
## Solution
|
||||
<section id='solution'>
|
||||
# --solutions--
|
||||
|
||||
```js
|
||||
// solution required
|
||||
```
|
||||
|
||||
</section>
|
||||
|
Reference in New Issue
Block a user