freeCodeCamp/curriculum/challenges/portuguese/08-coding-interview-prep/project-euler/problem-407-idempotents.por...

1012 B

id challengeType title videoUrl localeTitle
5900f5041000cf542c510016 5 Problem 407: Idempotents 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

tests:
  - text: <code>euler407()</code> deve retornar 39782849136421.
    testString: 'assert.strictEqual(euler407(), 39782849136421, "<code>euler407()</code> should return 39782849136421.");'

Challenge Seed

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

euler407();

Solution

// solution required