diff --git a/challenges/6-numeros-primos/crystal/pantotone/main-v2.cr b/challenges/6-numeros-primos/crystal/pantotone/main-v2.cr new file mode 100644 index 00000000..4bbb1196 --- /dev/null +++ b/challenges/6-numeros-primos/crystal/pantotone/main-v2.cr @@ -0,0 +1,16 @@ +number : Int32 = ARGV[0].to_i + +def isPrime(number : Int32) + return false if number < 2 + return true if number == 2 + + divisor : Int32 = 1 + unless divisor > Math.isqrt(number) + divisor += 1 + return false if number % divisor == 0 + end + + return true +end + +puts isPrime(number) \ No newline at end of file