freeCodeCamp/curriculum/challenges/portuguese/08-coding-interview-prep/project-euler/problem-216-investigating-t...

1.1 KiB

id challengeType title videoUrl localeTitle
5900f4451000cf542c50ff57 5 Problem 216: Investigating the primality of numbers of the form 2n2-1 Problema 216: Investigando a primalidade dos números da forma 2n2-1

Description

Considere os números t (n) da forma t (n) = 2n2-1 com n> 1. Os primeiros números são 7, 17, 31, 49, 71, 97, 127 e 161. Acontece que apenas 49 = 7 * 7 e 161 = 7 * 23 não são primos. Para n ≤ 10000 existem 2202 números t (n) que são primos.

Quantos números t (n) são primos para n ≤ 50.000.000?

Instructions

Tests

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

Challenge Seed

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

euler216();

Solution

// solution required