feat(isPrime): Utilizando loop while, Math.sqrt para retornar a raiz dos valores passados, funcional em todos os testes.

This commit is contained in:
Ramon Dias Ferreira 2022-10-29 18:50:55 -03:00
parent aaed0ee98d
commit f98db45a03

View File

@ -1,4 +1,6 @@
export function isPrime(value) {
// implementar logica aqui
var start = 2;
while (start <= Math.sqrt(value)) if (value % start++ < 1) return false;
return value > 1;
}