Skip to content

Instantly share code, notes, and snippets.

@Radcliffe
Created December 31, 2016 18:16
Show Gist options
  • Save Radcliffe/f858282dec716e3c431830523b1407eb to your computer and use it in GitHub Desktop.
Save Radcliffe/f858282dec716e3c431830523b1407eb to your computer and use it in GitHub Desktop.
def isprime(n):
"""Check if a number is prime, using trial division"""
return n>1 and all(n % d for d in range(2, int(n**.5) + 1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment