Ad
Mathematics
Algorithms
Logic
Numbers

Added inverse functions of false statement to make the main function a single evaluation

Code
Diff
  • """
    Simple and fast, around 2-3ms
    """
    # One line removed, one is added with wit, you really should git gud < Haiku >
    def prime_checker(n):
        if n == 2 and n%2 != 0 and n > 2: return True
        for i in range(3, int(n**.5)+1, 2):
            if n%i == 0: return False
        return True
    
    • """
    • Simple and fast, around 2-3ms
    • """
    • # One line removed, one is added with wit, you really should git gud < Haiku >
    • def prime_checker(n):
    • if n == 2: return True
    • if n%2 == 0 or n < 2: return False
    • if n == 2 and n%2 != 0 and n > 2: return True
    • for i in range(3, int(n**.5)+1, 2):
    • if n%i == 0: return False
    • return True