edited project euler problem 20 (#15748)
revert(challenges): Change function name, parameters given, and return Give better naming, avoid infiinite loop
This commit is contained in:
committed by
Quincy Larson
parent
0d70db5d98
commit
3d1ef747e2
@ -637,22 +637,26 @@
|
|||||||
"type": "bonfire",
|
"type": "bonfire",
|
||||||
"title": "Problem 20: Factorial digit sum",
|
"title": "Problem 20: Factorial digit sum",
|
||||||
"tests": [
|
"tests": [
|
||||||
"assert.strictEqual(euler20(), 648, 'message: \u003ccode\u003eeuler20()\u003c/code\u003e should return 648.');"
|
"assert.strictEqual(sumFactorialDigits(10), 27, 'message: \u003ccode\u003esumFactorialDigits(10)\u003c/code\u003e should return 27.');",
|
||||||
|
"assert.strictEqual(sumFactorialDigits(25), 72, 'message: \u003ccode\u003esumFactorialDigits(25)\u003c/code\u003e should return 72.');",
|
||||||
|
"assert.strictEqual(sumFactorialDigits(50), 216, 'message: \u003ccode\u003esumFactorialDigits(50)\u003c/code\u003e should return 216.');",
|
||||||
|
"assert.strictEqual(sumFactorialDigits(75), 432, 'message: \u003ccode\u003esumFactorialDigits(75)\u003c/code\u003e should return 432.');",
|
||||||
|
"assert.strictEqual(sumFactorialDigits(100), 648, 'message: \u003ccode\u003esumFactorialDigits(100)\u003c/code\u003e should return 648.');"
|
||||||
],
|
],
|
||||||
"solutions": [],
|
"solutions": [],
|
||||||
"translations": {},
|
"translations": {},
|
||||||
"challengeSeed": [
|
"challengeSeed": [
|
||||||
"function euler20() {",
|
"function sumFactorialDigits(n) {",
|
||||||
" // Good luck!",
|
" // Good luck!",
|
||||||
" return true;",
|
" return n;",
|
||||||
"}",
|
"}",
|
||||||
"",
|
"",
|
||||||
"euler20();"
|
"sumFactorialDigits(100);"
|
||||||
],
|
],
|
||||||
"description": [
|
"description": [
|
||||||
"n! means n × (n − 1) × ... × 3 × 2 × 1",
|
"n! means n × (n − 1) × ... × 3 × 2 × 1",
|
||||||
"For example, 10! = 10 × 9 × ... × 3 × 2 × 1 = 3628800,and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27.",
|
"For example, 10! = 10 × 9 × ... × 3 × 2 × 1 = 3628800,and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27.",
|
||||||
"Find the sum of the digits in the number 100!"
|
"Find the sum of the digits n!"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user