Skip to content

Instantly share code, notes, and snippets.

@tylertreat
Created December 31, 2014 21:34
Show Gist options
  • Select an option

  • Save tylertreat/7af285a7400c77e3b381 to your computer and use it in GitHub Desktop.

Select an option

Save tylertreat/7af285a7400c77e3b381 to your computer and use it in GitHub Desktop.
public static boolean isPrime(int n) {
for (int i = 2; i < Math.floor(Math.sqrt(n)); i++) {
if (n % i == 0)
return false;
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment