From ec8d2489290f6ca9e66bfeaaf3013e1305f8a708 Mon Sep 17 00:00:00 2001 From: gikf <60067306+gikf@users.noreply.github.com> Date: Tue, 13 Apr 2021 10:23:53 +0200 Subject: [PATCH] feat(curriculum): add two tests to challenge (#41793) * feat: add two tests * fix: missing backticks * fix: improve wording in tests description * fix: remove not needed link * fix: unify test with description --- ...ient-and-perfect-number-classifications.md | 34 +++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/curriculum/challenges/english/10-coding-interview-prep/rosetta-code/abundant-deficient-and-perfect-number-classifications.md b/curriculum/challenges/english/10-coding-interview-prep/rosetta-code/abundant-deficient-and-perfect-number-classifications.md index dc8afc78bb..33cbddb68a 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/rosetta-code/abundant-deficient-and-perfect-number-classifications.md +++ b/curriculum/challenges/english/10-coding-interview-prep/rosetta-code/abundant-deficient-and-perfect-number-classifications.md @@ -8,7 +8,7 @@ dashedName: abundant-deficient-and-perfect-number-classifications # --description-- -These define three classifications of positive integers based on their [proper divisors]( "Proper divisors"). +These define three classifications of positive integers based on their proper divisors. Let $P(n)$ be the sum of the proper divisors of `n` where proper divisors are all positive integers `n` other than `n` itself. @@ -22,7 +22,7 @@ If `P(n) > n` then `n` is classed as `abundant` # --instructions-- -Implement a function that calculates how many of the integers from `1` to `20,000` (inclusive) are in each of the three classes. Output the result as an array in the following format `[deficient, perfect, abundant]`. +Implement a function that calculates how many of the integers from `1` to `num` (inclusive) are in each of the three classes. Output the result as an array in the following format `[deficient, perfect, abundant]`. # --hints-- @@ -32,32 +32,38 @@ Implement a function that calculates how many of the integers from `1` to `20,00 assert(typeof getDPA === 'function'); ``` -`getDPA` should return an array. +`getDPA(5000)` should return an array. ```js -assert(Array.isArray(getDPA(100))); +assert(Array.isArray(getDPA(5000))); ``` -`getDPA` return value should have a length of 3. +`getDPA(5000)` return array should have a length of `3`. ```js -assert(getDPA(100).length === 3); +assert(getDPA(5000).length === 3); ``` -`getDPA(20000)` should equal [15043, 4, 4953] +`getDPA(5000)` should return `[3758, 3, 1239]`. ```js -assert.deepEqual(getDPA(20000), solution); +assert.deepEqual(getDPA(5000), [3758, 3, 1239]); +``` + +`getDPA(10000)` should return `[7508, 4, 2488]`. + +```js +assert.deepEqual(getDPA(10000), [7508, 4, 2488]); +``` + +`getDPA(20000)` should return `[15043, 4, 4953]`. + +```js +assert.deepEqual(getDPA(20000), [15043, 4, 4953]); ``` # --seed-- -## --after-user-code-- - -```js -const solution = [15043, 4, 4953]; -``` - ## --seed-contents-- ```js