2018-09-30 22:01:58 +00:00
---
id: 5900f5311000cf542c510042
title: 'Problem 451: Modular inverses'
2020-11-27 18:02:05 +00:00
challengeType: 5
2019-08-05 16:17:33 +00:00
forumTopicId: 302124
2021-01-13 02:31:00 +00:00
dashedName: problem-451-modular-inverses
2018-09-30 22:01:58 +00:00
---
2020-11-27 18:02:05 +00:00
# --description--
2018-09-30 22:01:58 +00:00
Consider the number 15.
2020-11-27 18:02:05 +00:00
2018-09-30 22:01:58 +00:00
There are eight positive numbers less than 15 which are coprime to 15: 1, 2, 4, 7, 8, 11, 13, 14.
2020-11-27 18:02:05 +00:00
2018-10-08 00:01:53 +00:00
The modular inverses of these numbers modulo 15 are: 1, 8, 4, 13, 2, 11, 7, 14
2020-11-27 18:02:05 +00:00
2018-09-30 22:01:58 +00:00
because
2020-11-27 18:02:05 +00:00
1\*1 mod 15=1
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
2\*8=16 mod 15=1
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
4\*4=16 mod 15=1
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
7\*13=91 mod 15=1
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
11\*11=121 mod 15=1
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
14\*14=196 mod 15=1
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
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.
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
Find ∑I(n) for 3≤n≤2·107
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
# --hints--
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
`euler451()` should return 153651073760956.
```js
assert.strictEqual(euler451(), 153651073760956);
```
# --seed--
## --seed-contents--
2018-09-30 22:01:58 +00:00
```js
function euler451() {
2020-09-15 16:57:40 +00:00
2018-09-30 22:01:58 +00:00
return true;
}
euler451();
```
2020-11-27 18:02:05 +00:00
# --solutions--
2018-09-30 22:01:58 +00:00
```js
// solution required
```