Skip to content

Instantly share code, notes, and snippets.

@rvalenciano
Last active September 11, 2015 21:29
Show Gist options
  • Save rvalenciano/9013b82e1691df83e732 to your computer and use it in GitHub Desktop.
Save rvalenciano/9013b82e1691df83e732 to your computer and use it in GitHub Desktop.
Is a number prime?
# Test if number is prime
def isPrime(num)
for d in 2..(num - 1)
if (num % d) == 0
return false
end
end
true
end
@rvalenciano
Copy link
Author

Description

Given a number, define if it's a prime number or no

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment