How to Check if a Number is Prime in Python
How to Check if a Number is Prime in Python

How to Check if a Number is Prime in Python

Tags
Published
November 14, 2022
Author
Mai The Dung

1. What is a Prime Number?

In number theory, a natural number n said to be prime if it has exactly two factors: 1 and the number itself (n). Recall from your school math: a number i is said to be a factor of the number n, if I divides n evenly. ✅

2. is_prime() to O(√n) Algorithm

notion image