HasteBin0

Python: One Line Prima.lity Test

Nov 4th, 2019
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.17 KB | None | 0 0
  1. from math import sqrt, ceil
  2. def prime(n: int) -> bool: return 0 not in (n % i for i in range(2, ceil(sqrt(n)) + 1))  # n > 3.
  3. print(tuple((i, prime(i)) for i in range(300)))
Add Comment
Please, Sign In to add comment