Feat: add new Markdown parser (#39800)

and change all the challenges to new `md` format.
This commit is contained in:
Oliver Eyton-Williams
2020-11-27 19:02:05 +01:00
committed by GitHub
parent a07f84c8ec
commit 0bd52f8bd1
2580 changed files with 113436 additions and 111979 deletions

View File

@ -5,8 +5,8 @@ challengeType: 5
forumTopicId: 385287
---
## Description
<section id='description'>
# --description--
<ol>
<li>Take an integer <code>n₀</code>, greater than zero.</li>
<li>Form the next number <code>n</code> of the series by reversing <code>n₀</code> and adding it to <code>n₀</code></li>
@ -30,17 +30,17 @@ And if `n₀` = 55 we get:
110 + 011 = 121, a palindrome!
```
Notice that the check for a palindrome happens <i>after</i> an addition.
Notice that the check for a palindrome happens *after* an addition.
Some starting numbers seem to go on forever; the recurrence relation for 196 has been calculated for millions of repetitions forming numbers with millions of digits, without forming a palindrome. These numbers that do not end in a palindrome are called <b>Lychrel numbers</b>.
Some starting numbers seem to go on forever; the recurrence relation for 196 has been calculated for millions of repetitions forming numbers with millions of digits, without forming a palindrome. These numbers that do not end in a palindrome are called **Lychrel numbers**.
For the purposes of this task a Lychrel number is any starting number that does not form a palindrome within 500 (or more) iterations.
<strong>Seed and related Lychrel numbers:</strong>
**Seed and related Lychrel numbers:**
Any integer produced in the sequence of a Lychrel number is also a Lychrel number.
In general, any sequence from one Lychrel number <i>might</i> converge to join the sequence from a prior Lychrel number candidate; for example the sequences for the numbers 196 and then 689 begin:
In general, any sequence from one Lychrel number *might* converge to join the sequence from a prior Lychrel number candidate; for example the sequences for the numbers 196 and then 689 begin:
```bash
196
@ -59,47 +59,65 @@ In general, any sequence from one Lychrel number <i>might</i> converge to join t
So we see that the sequence starting with 689 converges to, and continues with the same numbers as that for 196.
Because of this we can further split the Lychrel numbers into true <b>Seed</b> Lychrel number candidates, and <b>Related</b> numbers that produce no palindromes but have integers in their sequence seen as part of the sequence generated from a lower Lychrel number.
Because of this we can further split the Lychrel numbers into true **Seed** Lychrel number candidates, and **Related** numbers that produce no palindromes but have integers in their sequence seen as part of the sequence generated from a lower Lychrel number.
</section>
# --instructions--
## Instructions
<section id='instructions'>
Write a function that takes a number as a parameter. Return true if the number is a Lynchrel number. Otherwise, return false. Remember that the iteration limit is 500.
</section>
## Tests
# --hints--
<section id='tests'>
`isLychrel` should be a function.
```yml
tests:
- text: <code>isLychrel</code> should be a function.
testString: assert(typeof isLychrel === 'function');
- text: <code>isLychrel(12)</code> should return a boolean.
testString: assert(typeof isLychrel(12) === 'boolean');
- text: <code>isLychrel(12)</code> should return <code>false</code>.
testString: assert.equal(isLychrel(12), false);
- text: <code>isLychrel(55)</code> should return <code>false</code>.
testString: assert.equal(isLychrel(55), false);
- text: <code>isLychrel(196)</code> should return <code>true</code>.
testString: assert.equal(isLychrel(196), true);
- text: <code>isLychrel(879)</code> should return <code>true</code>.
testString: assert.equal(isLychrel(879), true);
- text: <code>isLychrel(44987)</code> should return <code>false</code>.
testString: assert.equal(isLychrel(44987), false);
- text: <code>isLychrel(7059)</code> should return <code>true</code>.
testString: assert.equal(isLychrel(7059), true);
```js
assert(typeof isLychrel === 'function');
```
</section>
`isLychrel(12)` should return a boolean.
## Challenge Seed
```js
assert(typeof isLychrel(12) === 'boolean');
```
<section id='challengeSeed'>
`isLychrel(12)` should return `false`.
<div id='js-seed'>
```js
assert.equal(isLychrel(12), false);
```
`isLychrel(55)` should return `false`.
```js
assert.equal(isLychrel(55), false);
```
`isLychrel(196)` should return `true`.
```js
assert.equal(isLychrel(196), true);
```
`isLychrel(879)` should return `true`.
```js
assert.equal(isLychrel(879), true);
```
`isLychrel(44987)` should return `false`.
```js
assert.equal(isLychrel(44987), false);
```
`isLychrel(7059)` should return `true`.
```js
assert.equal(isLychrel(7059), true);
```
# --seed--
## --seed-contents--
```js
function isLychrel(n) {
@ -107,13 +125,7 @@ function isLychrel(n) {
}
```
</div>
</section>
## Solution
<section id='solution'>
# --solutions--
```js
function isLychrel(n) {
@ -136,5 +148,3 @@ function isLychrel(n) {
return i == 500;
}
```
</section>