--- id: 5900f5041000cf542c510016 challengeType: 5 title: 'Problem 407: Idempotents' videoUrl: '' localeTitle: 'Problema 407: Idempotents' --- ## Description
Se calcularmos a2 mod 6 para 0 ≤ a ≤ 5 obtemos: 0,1,4,3,4,1.

O maior valor de um tal que a2 ≡ um mod 6 é 4. Vamos chamar M (n) o maior valor de um <n tal que a2 ≡ a (mod n). Então M (6) = 4.

Encontre ∑M (n) para 1 ≤ n ≤ 107.

## Instructions
## Tests
```yml tests: - text: euler407() deve retornar 39782849136421. testString: 'assert.strictEqual(euler407(), 39782849136421, "euler407() should return 39782849136421.");' ```
## Challenge Seed
```js function euler407() { // Good luck! return true; } euler407(); ```
## Solution
```js // solution required ```