Files
freeCodeCamp/curriculum/challenges/english/10-coding-interview-prep/project-euler/problem-451-modular-inverses.md
Oliver Eyton-Williams ee1e8abd87 feat(curriculum): restore seed + solution to Chinese (#40683)
* feat(tools): add seed/solution restore script

* chore(curriculum): remove empty sections' markers

* chore(curriculum): add seed + solution to Chinese

* chore: remove old formatter

* fix: update getChallenges

parse translated challenges separately, without reference to the source

* chore(curriculum): add dashedName to English

* chore(curriculum): add dashedName to Chinese

* refactor: remove unused challenge property 'name'

* fix: relax dashedName requirement

* fix: stray tag

Remove stray `pre` tag from challenge file.

Signed-off-by: nhcarrigan <nhcarrigan@gmail.com>

Co-authored-by: nhcarrigan <nhcarrigan@gmail.com>
2021-01-12 19:31:00 -07:00

958 B

id, title, challengeType, forumTopicId, dashedName
id title challengeType forumTopicId dashedName
5900f5311000cf542c510042 Problem 451: Modular inverses 5 302124 problem-451-modular-inverses

--description--

Consider the number 15.

There are eight positive numbers less than 15 which are coprime to 15: 1, 2, 4, 7, 8, 11, 13, 14.

The modular inverses of these numbers modulo 15 are: 1, 8, 4, 13, 2, 11, 7, 14

because

1*1 mod 15=1

2*8=16 mod 15=1

4*4=16 mod 15=1

7*13=91 mod 15=1

11*11=121 mod 15=1

14*14=196 mod 15=1

Let I(n) be the largest positive number m smaller than n-1 such that the modular inverse of m modulo n equals m itself. So I(15)=11. Also I(100)=51 and I(7)=1.

Find ∑I(n) for 3≤n≤2·107

--hints--

euler451() should return 153651073760956.

assert.strictEqual(euler451(), 153651073760956);

--seed--

--seed-contents--

function euler451() {

  return true;
}

euler451();

--solutions--

// solution required