diff --git a/seed/challenges/08-coding-interview-prep/rosetta-code.json b/seed/challenges/08-coding-interview-prep/rosetta-code.json index a559187025..4b0773b922 100644 --- a/seed/challenges/08-coding-interview-prep/rosetta-code.json +++ b/seed/challenges/08-coding-interview-prep/rosetta-code.json @@ -4367,6 +4367,69 @@ } } }, + { + "title": "Gamma function", + "description": ["
Implement one algorithm (or more) to compute the Gamma ($\\Gamma$) function (in the real field only).
The Gamma function can be defined as:
::::: $\\Gamma(x) = \\displaystyle\\int_0^\\infty t^{x-1}e^{-t} dt$
gamma
should be a function.",
+ "testString": "assert(typeof gamma=='function','gamma
should be a function.')"
+ },
+ {
+ "text": "gamma('+tests[0]+')
should return a number.",
+ "testString": "assert(typeof gamma(tests[0])=='number','gamma('+tests[0]+')
should return a number.')"
+ },
+ {
+ "text": "gamma('+tests[0]+')
should return '+results[0]+'
.",
+ "testString": "assert.equal(gamma(tests[0]),results[0],'gamma('+tests[0]+')
should return '+results[0]+'
.')"
+ },
+ {
+ "text": "gamma('+tests[1]+')
should return '+results[1]+'
.",
+ "testString": "assert.equal(gamma(tests[1]),results[1],'gamma('+tests[1]+')
should return '+results[1]+'
.')"
+ },
+ {
+ "text": "gamma('+tests[2]+')
should return '+results[2]+'
.",
+ "testString": "assert.equal(gamma(tests[2]),results[2],'gamma('+tests[2]+')
should return '+results[2]+'
.')"
+ },
+ {
+ "text": "gamma('+tests[3]+')
should return '+results[3]+'
.",
+ "testString": "assert.equal(gamma(tests[3]),results[3],'gamma('+tests[3]+')
should return '+results[3]+'
.')"
+ },
+ {
+ "text": "gamma('+tests[4]+')
should return '+results[4]+'
.",
+ "testString": "assert.equal(gamma(tests[4]),results[4],'gamma('+tests[4]+')
should return '+results[4]+'
.')"
+ }
+ ],
+ "id": "5a23c84252665b21eecc7e76",
+ "challengeType": "3",
+ "releasedOn": "June 1, 2018",
+ "files": {
+ "indexjs": {
+ "key": "indexjs",
+ "ext": "js",
+ "name": "index",
+ "contents": [
+ "function gaussianElimination (A,b) {",
+ " // Good luck!",
+ "}"
+ ],
+ "head": [],
+ "tail": [
+ "let tests=[.1,.2,.3,.4,.5];",
+ "let results=[",
+ " 9.513507698668736,",
+ " 4.590843711998803,",
+ " 2.9915689876875904,",
+ " 2.218159543757687,",
+ " 1.7724538509055159",
+ "];"
+ ]
+ }
+ }
+ },
{
"title": "Sailors, coconuts and a monkey problem",
"description": [