Valeriy 79d9012432 fix(curriculum): quotes in tests (#18828)
* fix(curriculum): tests quotes

* fix(curriculum): fill seed-teardown

* fix(curriculum): fix tests and remove unneeded seed-teardown
2018-10-20 23:32:47 +05:30

1.2 KiB

id, challengeType, title
id challengeType title
5900f5311000cf542c510042 5 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

Instructions

Tests

tests:
  - text: <code>euler451()</code> should return 153651073760956.
    testString: assert.strictEqual(euler451(), 153651073760956, '<code>euler451()</code> should return 153651073760956.');

Challenge Seed

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

euler451();

Solution

// solution required