Files
freeCodeCamp/curriculum/challenges/chinese/10-coding-interview-prep/project-euler/problem-120-square-remainders.md

768 B
Raw Permalink Blame History

id, title, challengeType, forumTopicId, dashedName
id title challengeType forumTopicId dashedName
5900f3e41000cf542c50fef7 问题 120平方余数 5 301747 problem-120-square-remainders

--description--

r 记为当 {(a 1)}^n + {(a + 1)}^n 除以 a^2 的余数。

例如,如果 a = 7 且 $n = 3$,则 $r = 42: 6^3 + 8^3 = 728 ≡ 42 \ \text{mod}\ 49$。 r 会随着 n 的变化而变化,但对于 $a = 7$,会有 $r_{max} = 42$。

对于 $3 ≤ a ≤ 1000$,求 $\sum{r}_{max}$。

--hints--

squareRemainders() 应该返回 333082500

assert.strictEqual(squareRemainders(), 333082500);

--seed--

--seed-contents--

function squareRemainders() {

  return true;
}

squareRemainders();

--solutions--

// solution required