2022-10-27 15:07:13 +00:00
|
|
|
export function isPrime(value) {
|
|
|
|
// implementar logica aqui
|
2022-11-02 20:58:17 +00:00
|
|
|
let primo;
|
|
|
|
if (
|
2022-11-02 22:35:18 +00:00
|
|
|
value == 2 ||
|
|
|
|
value == 3 ||
|
|
|
|
value == 5 ||
|
|
|
|
value == 7 ||
|
|
|
|
value == 11 ||
|
|
|
|
value == 13
|
2022-11-02 20:58:17 +00:00
|
|
|
) {
|
|
|
|
primo = true;
|
|
|
|
} else {
|
|
|
|
primo =
|
2022-11-02 22:35:18 +00:00
|
|
|
value % 2 != 0 &&
|
|
|
|
value % 3 != 0 &&
|
|
|
|
value % 5 != 0 &&
|
|
|
|
value % 7 != 0 &&
|
|
|
|
value % 11 != 0 &&
|
|
|
|
value % 13 != 0
|
2022-11-02 20:58:17 +00:00
|
|
|
? "true"
|
|
|
|
: "false";
|
|
|
|
}
|
|
|
|
return primo;
|
|
|
|
}
|