diff --git a/05-isPrime/index.js b/05-isPrime/index.js index ec9c4ac..41ab310 100644 --- a/05-isPrime/index.js +++ b/05-isPrime/index.js @@ -1,4 +1,22 @@ export function isPrime(value) { // implementar logica aqui - -} \ No newline at end of file + for (let i = 2; i < value; i++) + if (value % i === 0) { + return false; + } +return value > 1; +} + +// Resultados esperados +console.log(isPrime(2), true) // true +console.log(isPrime(3), true) // true +console.log(isPrime(4), false) // false +console.log(isPrime(5), true) // true +console.log(isPrime(6), false) // false +console.log(isPrime(7), true) // true +console.log(isPrime(8), false) // false +console.log(isPrime(25), false) // false +console.log(isPrime(31), true) // true +console.log(isPrime(2017), true) // true +console.log(isPrime(2048), false) // false +console.log(isPrime(1), false) // false \ No newline at end of file