Is Prime

Check if a number is a prime number by testing divisibility up to its square root.

Code

Algorithms
num > 1 and all(num % i != 0 for i in range(2, int(num**0.5) + 1))

Parameters

The number to check

Server

More Python Snippets