-
Notifications
You must be signed in to change notification settings - Fork 12.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
7 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
# Author: Tan Duc Mai | ||
# Email: [email protected] | ||
# Author: Tan Duc Mai | ||
# Email: [email protected] | ||
# Description: Three different functions to check whether a given number is a prime. | ||
# Return True if it is a prime, False otherwise. | ||
# Those three functions, from a to c, decreases in efficiency | ||
# (takes longer time). | ||
|
||
""" | ||
Three different functions to check whether a given number is a prime. | ||
Return True if it is a prime, False otherwise. | ||
Those three functions, from a to c, decreases in efficiency (takes longer time). | ||
""" | ||
from math import sqrt | ||
|
||
|
||
def is_prime_a(n): | ||
from math import sqrt | ||
if n < 2: | ||
return False | ||
sqrt_n = int(sqrt(n)) | ||
|