From 209e6ee2aa0d3c3363add4fc7e6e1c589f320e9b Mon Sep 17 00:00:00 2001 From: Emerson Fully <63175980+emersonfully@users.noreply.github.com> Date: Sat, 29 Oct 2022 14:16:32 -0300 Subject: [PATCH] =?UTF-8?q?feat(05-isPrime0:=20Adiciona=20fun=C3=A7=C3=A3o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 05-isPrime/index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/05-isPrime/index.js b/05-isPrime/index.js index ec9c4ac..44128c2 100644 --- a/05-isPrime/index.js +++ b/05-isPrime/index.js @@ -1,4 +1,5 @@ export function isPrime(value) { - // implementar logica aqui - + var start = 2; + while (start <= Math.sqrt(value)) if (value % start++ < 1) return false; + return value > 1; } \ No newline at end of file