Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Returns if a number is prime or not
- var Divisor;
- // Loop through all divisible values of the number
- for(Divisor = 2; Divisor <= floor(sqrt(argument0)); Divisor += 1;)
- {
- // See if the number is divisible by the divisor
- if(argument0 mod Divisor == 0)
- {
- // Return the number this is divisible by
- return Divisor;
- }
- }
- // This number is prime
- return 1;
Advertisement
Add Comment
Please, Sign In to add comment