Files
freeCodeCamp/curriculum/challenges/japanese/10-coding-interview-prep/project-euler/problem-455-powers-with-trailing-digits.md
2022-01-20 20:30:18 +01:00

1022 B

id, title, challengeType, forumTopicId, dashedName
id title challengeType forumTopicId dashedName
5900f5331000cf542c510046 Problem 455: Powers With Trailing Digits 5 302129 problem-455-powers-with-trailing-digits

--description--

Let f(n) be the largest positive integer x less than {10}^9 such that the last 9 digits of n^x form the number x (including leading zeros), or zero if no such integer exists.

For example:

\begin{align} & f(4) = 411\\,728\\,896 (4^{411\\,728\\,896} = ...490\underline{411728896}) \\\\ & f(10) = 0 \\\\ & f(157) = 743\\,757 (157^{743\\,757} = ...567\underline{000743757}) \\\\ & Σf(n), 2 ≤ n ≤ 103 = 442\\,530\\,011\\,399 \end{align}

Find \sum f(n), 2 ≤ n ≤ {10}^6.

--hints--

powersWithTrailingDigits() should return 450186511399999.

assert.strictEqual(powersWithTrailingDigits(), 450186511399999);

--seed--

--seed-contents--

function powersWithTrailingDigits() {

  return true;
}

powersWithTrailingDigits();

--solutions--

// solution required