freeCodeCamp/curriculum/challenges/chinese/08-coding-interview-prep/project-euler/problem-374-maximum-integer...

1.6 KiB
Raw Blame History

id challengeType title videoUrl localeTitle
5900f4e51000cf542c50fff6 5 Problem 374: Maximum Integer Partition Product 问题374最大整数分区产品

Description

数字n的整数分区是将n写为正整数之和的方法。

仅按其加数顺序不同的分区被认为是相同的。将n分成不同部分是n的分区其中每个部分最多出现一次。

5个不同部分的分区是5,4 + 1和3 + 2。

设fn是n的任何这种分区的部分到不同部分的最大乘积并且令mn是具有该乘积的n的任何这种分区的元素的数量。

所以f5= 6m5= 2。

对于n = 10具有最大乘积的分区是10 = 2 + 3 + 5其给出f10= 30和m10= 3。并且他们的产品f10·m10= 30·3 = 90

可以证实Σfn·mn对于1≤n≤100= 1683550844462。

找到Σfn·mn为1≤n≤1014。给出你的答案模数982451653即第5000万个素数。

Instructions

Tests

tests:
  - text: <code>euler374()</code>应该返回334420941。
    testString: 'assert.strictEqual(euler374(), 334420941, "<code>euler374()</code> should return 334420941.");'

Challenge Seed

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

euler374();

Solution

// solution required