freeCodeCamp/curriculum/challenges/chinese/08-coding-interview-prep/rosetta-code/amicable-pairs.chinese.md

2.9 KiB
Raw Blame History

title id challengeType videoUrl localeTitle
Amicable pairs 5949b579404977fbaefcd737 5 友好的对

Description

如果$ N \ neq M $和N $ $的适当除数之和($ \ mathrm {sum}\ mathrm {propDivs}N两个整数$ N $和$ M $被认为是友好对 $$ = M $以及$ \ mathrm {sum}\ mathrm {propDivs}M= N $。示例1184和1210是友好对具有适当的除数1,2,4,8,16,32,37,74,148,296,592和1,2,5,10,11,25,55分别为110,121,242,605。任务计算并显示低于20,000的Amicable对有八个。相关任务适当的除数 丰富,缺陷和完善的数字分类 等分序列分类及其友好分类。

Instructions

Tests

tests:
  - text: <code>amicablePairsUpTo</code>是一个函数。
    testString: 'assert(typeof amicablePairsUpTo === "function", "<code>amicablePairsUpTo</code> is a function.");'
  - text: '<code>[[220,284]]</code> <code>amicablePairsUpTo(300)</code>应返回<code>[[220,284]]</code> 。'
    testString: 'assert.deepEqual(amicablePairsUpTo(300), answer300, "<code>amicablePairsUpTo(300)</code> should return <code>[[220,284]]</code>.");'
  - text: '<code>[[220,284],[1184,1210],[2620,2924]]</code> <code>amicablePairsUpTo(3000)</code>应返回<code>[[220,284],[1184,1210],[2620,2924]]</code> 。'
    testString: 'assert.deepEqual(amicablePairsUpTo(3000), answer3000, "<code>amicablePairsUpTo(3000)</code> should return <code>[[220,284],[1184,1210],[2620,2924]]</code>.");'
  - text: '<code>[[220,284],[1184,1210],[2620,2924],[5020,5564],[6232,6368],[10744,10856],[12285,14595],[17296,18416]]</code> <code>amicablePairsUpTo(20000)</code>应返回<code>[[220,284],[1184,1210],[2620,2924],[5020,5564],[6232,6368],[10744,10856],[12285,14595],[17296,18416]]</code> 。'
    testString: 'assert.deepEqual(amicablePairsUpTo(20000), answer20000, "<code>amicablePairsUpTo(20000)</code> should return <code>[[220,284],[1184,1210],[2620,2924],[5020,5564],[6232,6368],[10744,10856],[12285,14595],[17296,18416]]</code>.");'

Challenge Seed

function amicablePairsUpTo (maxNum) {
  // Good luck!
  return true;
}

After Test

console.info('after the test');

Solution

// solution required