---
id: 5900f3811000cf542c50fe94
challengeType: 5
title: 'Problem 21: Amicable numbers'
videoUrl: ''
localeTitle: 问题21：友好的数字
---

## Description
<section id="description">设d（ <var>n</var> ）定义为<var>n</var>的适当除数之<var>和</var> （小于<var>n的</var>数均匀分成<var>n</var> ）。如果d（ <var>a</var> ）= <var>b</var>并且d（ <var>b</var> ）= <var>a</var> ，其中<var>a</var> ≠ <var>b</var> ，则<var>a</var>和<var>b</var>是友好对，并且<var>a</var>和<var>b</var>中的每<var>一个</var>被称为友好数字。例如，220的适当除数是1,2,4,5,10,11,20,22,44,55和110;因此d（220）= 284. 284的适当除数是1,2,4,71和142;所以d（284）= 220.评估<var>n</var>下所有友好数字的总和。 </section>

## Instructions
<section id="instructions">
</section>

## Tests
<section id='tests'>

```yml
tests:
  - text: <code>sumAmicableNum(1000)</code>应返回504。
    testString: 'assert.strictEqual(sumAmicableNum(1000), 504, "<code>sumAmicableNum(1000)</code> should return 504.");'
  - text: <code>sumAmicableNum(2000)</code>应该返回2898。
    testString: 'assert.strictEqual(sumAmicableNum(2000), 2898, "<code>sumAmicableNum(2000)</code> should return 2898.");'
  - text: <code>sumAmicableNum(5000)</code>应该返回8442。
    testString: 'assert.strictEqual(sumAmicableNum(5000), 8442, "<code>sumAmicableNum(5000)</code> should return 8442.");'
  - text: <code>sumAmicableNum(10000)</code>应返回31626。
    testString: 'assert.strictEqual(sumAmicableNum(10000), 31626, "<code>sumAmicableNum(10000)</code> should return 31626.");'

```

</section>

## Challenge Seed
<section id='challengeSeed'>

<div id='js-seed'>

```js
function sumAmicableNum(n) {
  // Good luck!
  return n;
}

sumAmicableNum(10000);

```

</div>



</section>

## Solution
<section id='solution'>

```js
// solution required
```
</section>
