freeCodeCamp/curriculum/challenges/portuguese/08-coding-interview-prep/project-euler/problem-479-roots-on-the-ri...

1.2 KiB

id challengeType title videoUrl localeTitle
5900f54b1000cf542c51005d 5 Problem 479: Roots on the Rise Problema 479: Raízes em Ascensão

Description

Vamos ak, bk e ck representam as três soluções (números reais ou complexos) para a expressão 1 / x = (k / x) 2 (k + x2) - kx.

Por exemplo, para k = 5, vemos que {a5, b5, c5} é aproximadamente {5,727244, -0,363622 + 2,057397i, -0,363622-2,057397i}.

Seja S (n) = Σ (ak + bk) p (bk + ck) p (ck + ak) p para todos os inteiros p, k tal que 1 ≤ p, k ≤ n.

Curiosamente, S (n) é sempre um inteiro. Por exemplo, S (4) = 51160.

Encontre S (106) módulo 1 000 000 007.

Instructions

Tests

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

Challenge Seed

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

euler479();

Solution

// solution required