Skip to content

Commit 7ade130

Browse files
Running Time and Complexity
1 parent a7b662c commit 7ade130

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Enter your code here. Read input from STDIN. Print output to STDOUT
2+
import math
3+
n = int(input())
4+
for i in range(n):
5+
a = int(input())
6+
flag = 0
7+
if a == 1:
8+
print("Not prime")
9+
elif a==2:
10+
print("Prime")
11+
else:
12+
if a%2 == 0:
13+
flag = 1
14+
else:
15+
for i in range(3,math.floor(math.sqrt(a))+1,2):
16+
if a%i == 0:
17+
flag = 1
18+
break
19+
if flag == 0:
20+
print("Prime")
21+
else:
22+
print("Not prime")

0 commit comments

Comments
 (0)