fix(challenges): Edit Description, Tests, and Add Solution for Project Euler 48 (#17145)

Added `<sup>` tags to the description to make it more like the one on
projecteuler.net. Also added additional tests and a solution.

Here's a solution for QA:

```
```

BREAKING CHANGE: None
This commit is contained in:
Kristofer Koishigawa
2018-05-12 06:00:46 +09:00
committed by mstellaluna
parent 26c29f25aa
commit 080c27e7cb

View File

@ -1687,21 +1687,24 @@
"type": "bonfire", "type": "bonfire",
"title": "Problem 48: Self powers", "title": "Problem 48: Self powers",
"tests": [ "tests": [
"assert.strictEqual(euler48(), 9110846700, 'message: <code>euler48()</code> should return 9110846700.');" "assert.strictEqual(selfPowers(10, 3), 317, 'message: <code>selfPowers(10, 3)</code> should return 317.');",
"assert.strictEqual(selfPowers(150, 6), 29045, 'message: <code>selfPowers(150, 6)</code> should return 29045.');",
"assert.strictEqual(selfPowers(673, 7), 2473989, 'message: <code>selfPowers(673, 7)</code> should return 2473989.');",
"assert.strictEqual(selfPowers(1000, 10), 9110846700, 'message: <code>selfPowers(1000, 10)</code> should return 9110846700.');"
], ],
"solutions": [], "solutions": ["function selfPowers(power, lastDigits) {\n let sum = 0;\n const modulo = Math.pow(10, lastDigits);\n\n for (let i = 1; i <= power; i++) {\n let temp = i;\n for (let j = 1; j < i; j++) {\n temp *= i;\n temp %= modulo;\n }\n\n sum += temp;\n sum %= modulo;\n }\n\n return sum;\n}"],
"translations": {}, "translations": {},
"challengeSeed": [ "challengeSeed": [
"function euler48() {", "function selfPowers(power, lastDigits) {",
" // Good luck!", " // Good luck!",
" return true;", " return true;",
"}", "}",
"", "",
"euler48();" "selfPowers(1000, 10);"
], ],
"description": [ "description": [
"The series, 11 + 22 + 33 + ... + 1010 = 10405071317.", "The series, 1<sup>1</sup> + 2<sup>2</sup> + 3<sup>3</sup> + ... + 10<sup>10</sup> = 10405071317.",
"Find the last ten digits of the series, 11 + 22 + 33 + ... + 10001000." "Find the last ten digits of the series, 1<sup>1</sup> + 2<sup>2</sup> + 3<sup>3</sup> + ... + 1000<sup>1000</sup>."
] ]
}, },
{ {