Problem:
Prime Numbers A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. Write a program which reads a list of N integers and prints the number of prime numbers in the list. Input The first line contains an integer N , the number of elements in the list.  N numbers are given in the following lines. Output Print the number of prime numbers in the given list. Constraints 1 ≤ N ≤ 10000 2 ≤ an element of the list ≤ 10 8  Sample Input 1 5
2
3
4
5
6 Sample Output 1 3 Sample Input 2 11
7
8
9
10
11
12
13
14
15
16
17 Sample Output 2 4

Solution (Python):
import math

def isprime(N):
	if N == 2:
		return True
	if N <= 1 or N % 2 == 0:
		return False
	lim = int(math.sqrt(N))
	for i in range(3, lim + 1, 2):
		if N % i == 0:
			return False
		i += 2
	return True

N = int(input())
ans = 0
for i in range(N):
	ans += int(isprime(int(input())))
print(ans)

Solution (Python):
import math
n = int(input())
prime = n
for i in range(n):
    num = int(input())
    for j in range(2,int(math.sqrt(num)+1)):
      if num % j == 0:
       prime -= 1
       break
print(prime)

Solution (Python):
import math
n=int(input())
def sosu(a):
    for i in range(2,int(math.sqrt(a))+1):
        if a%i==0:
            return False
    return True
m=0
for i in range(n):
    a=int(input())
    if sosu(a):
        m+=1
print(m)

Solution (Python):
import math
def is_prime(x):
    if x == 1: return False
    for i in range(2,int(math.sqrt(x))+1):
        if x%i == 0: return False
    return True
n = int(input())
ans = 0
for i in range(n):
    x = int(input())
    ans += is_prime(x)
print(ans)

Solution (Python):
import math
n=int(input())
a=0
def prime(b) :
    for i in range(2,int(math.sqrt(b))+1):
        if b%i== 0:
            return False
    return True

for i in range(n) :
    if prime(int(input())) :
        a+=1

print(a)

Solution (Python):
import math
def is_prime(n):
    if n==1:
        return False
    for k in range(2,int(math.sqrt(n))+1):
        if n%k==0:
            return False
    return True
n=int(input())
m=0
c=0
while True:
    if m==n:
        break
    a=int(input())
    
    if is_prime(a)==True:
        c=c+1
 
    m=m+1
print(c)

Solution (Python):
def is_prime(n):
    if n == 1 or n == 2:
        return True
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            return False
    return True

n = int(input())
ans = 0
for _ in range(n):
    if is_prime(int(input())):
        ans += 1
print(ans)

Solution (Python):
import math

def prime(x):
	for i in range(2,int(math.sqrt(x))+1):
		if x%i == 0:
			return 0
	return 1

n=int(input())
count=0
for i in range(n):
	x=int(input())
	if prime(x):
		count+=1
print(count)

Solution (Python):


import math

ans = 0
while True:
   try:
      n = int(input())
      if n == 2:
         ans += 1
         continue
      if n % 2 == 0:
         continue
      
      c = 0
      for i in range(2, math.floor(math.sqrt(n)) + 1):
         if n % i == 0:
            c += 1
      if c == 0:
         
         ans += 1

   except EOFError:
      break
   
print(ans)

Solution (Python):
from math import sqrt
n = int(input())
p = 0

for i in range(n):
    x = int(input())
    if x == 2:
        p += 1
    elif x%2 == 1:
        j=3
        f = 0
        while j < (int(sqrt(x))+1):
            if x%j == 0:
                f = 1
                break
            else:
                j += 2
        if f == 0:
            p += 1
print(p)

Solution (Python):
def p(n):
  if n == 2: return 1
  if not n & 1: return 0
  return pow(2, n-1, n) == 1
print(sum(1 for _ in range(int(input())) if p(int(input()))))

Solution (Python):
import math
def prime(a):
    if a == 2 or a == 3:
        return True
    for i in range(2, int(math.sqrt(a))+2):
        if a%i == 0:
            return False
    return True

b = int(input())
count = 0
for i in range(b):
    x = int(input())
    if prime(x):
        count += 1
print(count)

Solution (Python):
def is_prime(x):
    answer = True
    if x == 1:
        answer = False
    elif x == 2:
        answer = True
    elif x % 2 == 0:
        answer = False
    else:
        i = 3
        while i <= x ** 0.5:
            if x % i == 0:
                answer = False
                break
            i += 1
    return answer

if __name__ == "__main__":
    n = int(input())
    count = 0
    for _ in range(n):
        x = int(input())
        if is_prime(x):
            count += 1
        
    print(count)

Solution (Python):
import math
n = int(input())
a=[]
for i in range(n):
  a.append(int(input()))
def isprime(x):
  if x == 2:
    return True
  if x < 2 or (x%2) == 0:
    return False
  i = 3
  while i <= math.sqrt(x):
    if (x%i) == 0:
      return False
    i += 2
  return True
b=0
for ai in a:
  if isprime(ai) == True:
    b += 1
print(b)

Solution (Python):
import math
n = int(input())
a = 0

def is_prime(m: int)->bool:
    m2 = int(math.sqrt(m))+1
    for j in range(2, m2):
        if m % j == 0:
            return True
    else:
        return False

for i in range (n):
    m = int(input())
    if is_prime(m): a += 0
    else:
        a+=1
print (a)

Solution (Python):
import math



    
    
def isPrime(x):
        if x==2:
            return True
            
        if x<2 or x%2==0:
            return False
        a=int(math.sqrt(x))
        for i in range(3,a+1,2):
            if x%i==0:
                return False
            i+=2
        return True
    
x=int(input())
ans=0
for i in range(x):
    ans+=int(isPrime(int(input())))
    
print(ans)

Solution (Python):
def Prime(n):
    for i in range(2,n):
        if i * i > n:
            return True
        if n % i == 0:
            return False
    return True

n = int(input())
count = 0
for i in range(n):
    x = int(input())
    count += Prime(x)
print(count)

Solution (Python):
import math
def sosuu(x):
    if x == 2:
        return True
    if x < 2 or x % 2 == 0:
        return False
    i = 3
    while i <= math.sqrt(x):
        if x % i ==0:
            return False
        i = i + 2
    return True
    
c = 0
while True:
    try:
        x = int(input())
    except:
        break
    if sosuu(x) == True:
        c += 1
print(c)

Solution (Python):
import math

def isprime(N):
	if N == 2:
		return True
	if N <= 1 or N % 2 == 0:
		return False
	lim = int(math.sqrt(N))
	for i in range(3, lim + 1, 2):
		if N % i == 0:
			return False
		i += 2
	return True

N = int(input())
ans = 0
for i in range(N):
	ans += int(isprime(int(input())))
print(ans)

Solution (Python):

def prime_number(x):
    if x == 2:
        return True
    if x < 2 or x % 2 == 0:
        return False
    for i in range(3,int(x**0.5)+1,2):
        if x % i == 0:
            return False
    return True

N = int(input())
count = 0
for _ in range(N):
    i = int(input())
    count += prime_number(i)
print(count)

Solution (Python):
import math as ma

num = int(input())
ans = 0
for i in range(num):
    x = int(input())
    ok = 1
    for j in range(2,int(ma.sqrt(x)+1)):
        if (x % j == 0):
            ok = 0
            break
    ans += ok

print(ans)

Solution (Python):
import math
a = []
cnt = 0
n = int(input())
for _ in range(n) : 
	a.append(int(input()))

def isPrime(x) :
	if x == 2 : 
		return True
	if x < 2 or x % 2 == 0 : 
		return False
	i = 3
	while i <= math.sqrt(x) :
		if x % i == 0 :
			return False
		i += 2
	return True
	
for i in a : 
	if isPrime(i) :
		cnt += 1
	
print(cnt)

Solution (Python):
import math

def isPrime(x):
	for i in range(2,int(math.sqrt(x))+1):
		if x%i == 0:
			return 0
	return 1

n=int(input())
ans=0
for i in range(n):
	x=int(input())
	if isPrime(x):
		ans+=1
print(ans)

Solution (Python):
n = int(input())
x = []
for i in range(n):
    x.append(int(input()))

def isPrime(x):
    if x == 2:
        return True
    
    if x < 2 or x%2 == 0:
        return False
    
    i = 3
    while i <= x**0.5:
        if x%i == 0:
            return False
        i += 2
    
    return True

counter = 0
for i in range(n):
    if isPrime(x[i]) == True:
        counter += 1

print(counter)

Solution (Python):
import math

def using_sqrt(number):
    
    for divisor in range(2,math.floor(math.sqrt(number))+1):
        if number % divisor == 0:
            return False
    return True

N = int(input())

count = 0
for i in range(N):
    q = int(input())
    if using_sqrt(q):
        count += 1
print(count)

Solution (Python):
import math
n = int(input())
ans = 0
for i in range(n):
    x = int(input())
    p = 1
    for z in range(2, int(math.sqrt(x))+1):
        if x % z == 0:
            p = 0
            break
    ans += p
print(ans)

Solution (Python):
from math import sqrt
n = int(input())
cnt = 0
for i in range(n):
    b = True
    x = int(input())
    xroot = int(sqrt(x))
    for i in range(xroot+1):
        if i >= 2 and x%i == 0:
            b = False
            break
    if b == True:
        cnt += 1

print(cnt)

Solution (Python):
import math
def is_prime(n):
    if n==1:
        return False
    for k in range(2,int(math.sqrt(n))+1):
        if n%k==0:
            return False
    return True
n=int(input())
m=0
c=0
while True:
    if m==n:
        break
    a=int(input())
    
    if is_prime(a)==True:
        c=c+1
 
    m=m+1
print(c)

Solution (Python):
from math import sqrt
n = int(input())
ans = 0
for i in range(n):
    x = int(input())
    ok = 1
    for z in range(2, int(sqrt(x))+1):
        if x % z == 0:
            ok = 0
            break
    ans += ok
print(ans)

Solution (Python):
import math

n = int(input())
numbers = [int(input()) for i in range(n)]

def isPrime(x):
    if x == 2:
        return True
    if x < 2 or x % 2 == 0:
        return False
    i = 3
    while i <= math.sqrt(x):
        if x % i == 0:
            return False
        i += 2
    
    return True

c =  0
for i in range(n):
    if isPrime(numbers[i]):
        c += 1

print(c)

Solution (Python):
import math


def is_prime(a):
    sqrt_a = int(math.sqrt(a))
    for i in range(2, sqrt_a + 1):
        if a % i == 0:
            return False
    return True


def main():
    n = int(input())
    count = 0

    for i in range(n):
        a = int(input())
        if is_prime(a):
            count += 1

    print(count)


if __name__ == "__main__":
    main()

Solution (Python):
import math

n = int(input())
count = 0

def w(a) :
    for i in range(2, int(math.sqrt(a))+1):
        if a % i == 0:
            return False
    return True

for i in range(n):
    a = int(input())
    if w(a):
        count += 1
        
print(count)

Solution (Python):
def is_prime(x):
    for d in range(2, int(x**.5)+1):
        if x%d == 0:
            return False
    return True

n = int(input())
print(sum(is_prime(int(input())) for _ in range(n)))

Solution (Python):
N = 10**4
primes = range(2, N+1)
for d in range(2, int(N**.5)+1):
  primes = [x for x in primes if x % d or x == d]

count = 0
for _ in range(int(input())):
    x = int(input())
    if x <= N:
        count += (x in primes)
    else:
        for prime in primes:
            if x % prime == 0:
                break
        else:
            count += 1
print(count)

Solution (Python):
import math

def prime(x):
    if x == 2 or x == 3:
        return True
    for i in range(2, int(math.sqrt(x))+2):
        if x%i == 0:
            return False
    return True

n = int(input())
count = 0
for i in range(n):
    x = int(input())
    if prime(x):
        count += 1
print(count)

Solution (Python):



n = int(input())
c = 0
for i in range(n):
    m = int(input())
    if m != 2 and m % 2 == 0:
        c += 1
        continue
    i = 3
    while i * i <= m:
        if m % i == 0:
            c += 1
            break
        i += 2
print(n-c)

Solution (Python):


from math import sqrt

n = int(input())

ans = 0

for i in range(n):
    x = int(input())
    a = 1
    for z in range(2, int(sqrt(x))+1):
        if x % z == 0:
            a = 0
            break
    ans += a
print(ans)

Solution (Python):
import sys
prime = lambda x: True if x==2 else False if x<2 or not x%2 else pow(2,x-1,x)==1
inp = sys.stdin.readlines()
print(len([prime(e) for e in list(map(int, inp[1:])) if prime(e)==1]))

Solution (Python):

import sys
input=sys.stdin.readline

import math

def is_prime(n):
        if n == 1: return False

        for k in range(2, int(math.sqrt(n)) + 1):
            if n % k == 0:
                return False
        return True

def main():
    number=int(input())
    numbers=[]
    numbers=[int(input()) for _ in range(number)]
    counter=0
    for n in numbers:
        ans=is_prime(n)
        if ans ==True:
            counter+=1
        else:
            continue
    print(counter)
if __name__=="__main__":
    main()

Solution (Python):
n = int(input())
cnt = 0

for i in range(n):
    x = int(input())
    rt_x = int(pow(x,1/2)) +1
    flag = 1
    for j in range(2,rt_x):
        if x%j==0:
            flag = 0
            break
    cnt += flag
print(cnt)

Solution (Python):
from math import sqrt
def isPrime(n):
  if n < 2:
    
    return False
  if n == 2:
    
    return True
  for p in range(2, int(sqrt(n))+1):
      if n % p == 0:
        
        return False
  
  return True
m=int(input())
s=0
for i in range(m):
    l=int(input())
    if isPrime(l)==True:
        s+=1
print(s)

Solution (Python):





import sys
import math

loop = int(sys.stdin.readline())










def is_prime(x):
    
    if (x%2==0 and x!=2) or (x%3==0 and x!=3) or (x%5==0 and x!=5):
        return False
    for d in range(2, math.floor(math.sqrt(x))+1):
        if x%d==0:
            return False
    return True

count = 0
for _ in range(loop):
    x = sys.stdin.readline()
    
    if is_prime(int(x)):
        count  += 1
print(count)

Solution (Python):
import math 

def isPrime(n):
    if n<=1:
        return False
    for i in range(2,int(math.sqrt(n)+1)):
        if (n%i == 0):
            return False
    return True

def countPrime(x):
    count = 0
    for e in x:
        if isPrime(e) is True:
            count += 1
    return count
    
n = int(input())
x = []
for i in range(n):
    x.append(int(input()))
print(countPrime(x))

Solution (Python):
import math
def S(N) :
    for i in range(2, int(math.sqrt(N))+1) :
        if N % i == 0 :
            return 'F'
    return 'T'
    

n = int(input())
ans = 0
for j in range(n) :
    a = int(input())
    if S(a) == 'T' :
        ans += 1

print(ans)

Solution (Python):
  
def f(x):
    if x==2:
        return 1
    if x<2 or x%2==0:
        return 0
    i=3
    while i<=x**(1/2):
        if x%i==0:
            return 0
        i+=2
    return 1

n=int(input())
s=0
for i in range(n):
    x=int(input())
    s+=f(x)
print(s)

Solution (Python):
def sosu(n):
    if n == 1:
        return False
    for i in range(2,int(n**0.5)+1):
        if n % i == 0:
            return False
    return True
    
    
n = int(input())
ans = 0
for i in range(n):
    m = int(input())
    if sosu(m):
        ans += 1
    else :
        ans += 0
print(ans)

Solution (Python):
import math

def prime(x):
    if x==2:
        return 'true'
    elif x%2==0:
        return 'false'
    else:
        i=3
        while i<=math.sqrt(x):
            if x%i==0:
                return 'false'
            i+=2
        return 'true'

n=int(input())
s=0
for j in range(n):
    x=int(input())
    r=prime(x)
    if r=='true':
        s+=1
print(s)

Solution (Python):
def isprime(x):
    if x == 2:
        return True
    if x < 2 or x%2==0:
        return False
    i = 3
    while i <= x**(1/2):
        if x%i==0:
            return False
        i = i + 2
    return True
n=int(input())
count=0
for i in range(n):
    x=int(input())
    if isprime(x)==True:
        count+=1
print(count)

Solution (Python):
def isPrime(n):
    for i in range(2, n):
        if i * i > n:
            return 1
        if n % i == 0:
            return 0
    return 1

ans = 0
n = int(input())
for i in range(n):
    x = int(input())
    ans = ans + isPrime(x)

print(ans)

Solution (Python):
import math
def p(x):
	for i in range(2,int(math.sqrt(x))+1):
		if x%i == 0:
			return 0
	return 1
n=int(input())
ans=0
for i in range(n):
	x=int(input())
	if p(x):
		ans+=1
print(ans)

Solution (Python):
import math
c = 0
n = int(input())

for j in range(n):
    x = int(input())
    
    if x == 2:
        c = c + 1
        
    if x < 2 or x % 2 == 0:
        c = c
        
    else:
        if x > 2 and x % 2 != 0:    
            i = 3
            a = 0
            while i <= math.sqrt(x):
                if x % i == 0:
                    c = c
                    a = a + 1
                    break
                else:
                    i = i + 2
            if a == 0:
                c = c + 1
print(c)

Solution (Python):
import math
def isprime(n):
    for i in range(2,int(math.sqrt(n))+1):
        if n%i==0:
            return False
    return True
n=int(input())
sosuu=[]
for j in range(n):
    m=int(input())
    if isprime(m):
        sosuu.append(m)
print(len(sosuu))

Solution (Python):
N = int(input())

def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1

total = 0
for i in range(N):
    n = int(input())
    if is_prime(n):
        total +=1
print(total)

Solution (Python):
import math
n=int(input())
s=0
for i in range(n):
    x=int(input())
    a=0
    if x==2:
        s+=1
    else:
        for j in range(2,int(math.sqrt(x))+1):
            if x%j==0:
                a+=1
                break
        if a==0:
            s+=1
print(s)

Solution (Python):
def prime(n):
  p = 2
  while p * p <= n:
    if n % p == 0:
      return 0
    p += 1
  return 1

n = int(input())
ans = 0
for i in range(n):
  m = int(input())
  ans += prime(m)
print(ans)

Solution (Python):
def isPrime(n):
  if n < 2:
    
    return False
  if n == 2:
    
    return True
  for p in range(2, int(n**0.5)+1):
      if n % p == 0:
        
        return False
  
  return True
total=0
if __name__ == "__main__":
    a=int(input())
    for i in range(a):
        b=int(input())
        if isPrime(b):
            total+=1
        else:
            pass
    print(total)

Solution (Python):
import math as ma
n=int(input())
m=0
for i in range (n):
    a = int(input())
    if a==2:
        m+=1
    if a>2:
        for j in range(2,int(ma.sqrt(a))+2):
            if a%j==0:
                break
            if j ==int(ma.sqrt(a))+1:
                m+=1
print(m)

Solution (Python):
import math
x = 0
a = int(input())
for _ in range(a):
    n = int(input())
    if n == 1:
        x = x + 1
        continue
    for i in range(2,int(math.sqrt(n))+1):
        if n % i == 0:
            x = x + 1
            break
print(a-x)

Solution (Python):
import math
def sosu(x):
    if x == 2:
        return 1
    elif x < 2 or x % 2 == 0:
        return 0
    i = 3
    while i <= math.sqrt(x):
        if x % i == 0:
            return 0
        i += 2
    return 1
    
n = int(input())
m = 0
for i in range(n):
    a = int(input())
    b = sosu(a)
    m += b 
print(m)

Solution (Python):
import math
n=int(input())
s=0
for i in range(n):
    a=int(input())
    b=math.ceil(a**0.5)
    if a==2:
        s+=1
    elif a%2==0 or a < 2:
        continue
    else:
        c=0
        for j in range(3,b+1,2):
            if a%j==0:
                c+=1
                break
        if c==0:
            s+=1
print(s)

Solution (Python):
import math
n = int(input())
lst = [int(input()) for i in range(n)]
s = 0

def isprime(x):
    if x == 2:
        return True
    if x < 2 or x%2 == 0:
        return False
    i = 3
    while i <= math.sqrt(x):
        if x%i == 0:
            return False
        i = i+2
    return True

for i in range(n):
    if isprime(lst[i]):
        s += 1

print(s)

Solution (Python):
prime=[2]
lst=[1]*(10**4+1) 

for i in range(3,10**4,2):
    if lst[i]:
        prime.append(i)
        token=3
        while i*token<10**4:
            if lst[i*token]: lst[i*token]=0
            token+=2

n=int(input())
sm=0
for _ in range(n):
    np=int(input())
    if np<=10**4:
        sm+=np in prime
    else :
        for p in prime:
            if np%p==0 : break
        else : sm+=1

print(sm)

Solution (Python):
def is_prime(q, k=50):
    q = abs(q)
    if q == 0:
        return False
    elif q == 2:
        return True
    return pow(2, q-1, q) == 1


n = int(input())
result = 0
for i in range(n):
    x = int(input())
    if is_prime(x):
        result += 1

print(result)

Solution (Python):
def is_prime(n):
    if n == 1:
        return False
    if n == 2:
        return True
    if n % 2 == 0:
        return False
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            return False
    return True


N = int(input())
cnt = 0
for i in range(N):
    if is_prime(int(input())):
        cnt += 1
print(cnt)

Solution (Python):
import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

try:
    N = int(input().strip())
    nums = [int(input()) for i in range(N)]
except ValueError:
    print('ValueError')

num_p = 0
for i in nums:
    if is_prime(i)==True:
        num_p += 1
print(str(num_p))

Solution (Python):


import math

n = int(input())
B=0

for i in range(n):
    N = int(input())
    A=0
    s = int(math.sqrt(N)+1)
    if N==2:
        B += 1
    else:
        for j in range(2,s):
            if N%j==0:
                A += 1
                break
        if (A==0):
            B += 1
print(B)

Solution (Python):
def isPrime(x):
    if x == 2:
        return True
    if x < 2 or x & 1 == 0:
        return False
    for i in range(3, int(x ** 0.5 + 1)):
        if x % i == 0:
            return False
    return True

print(sum(map(isPrime, [int(input()) for _ in range(int(input()))])))

Solution (Python):
import math


def main():
    
    n = int(input())
    elements = [int(input()) for i in range(n)]
    count = 0

    for element in elements:
        if prime_num(element) == True:
            count += 1

    print(count)


def prime_num(element):
    if element == 2:
        return True
    elif element < 1 or element % 2 == 0:
        return False
    else:
        p = 3
        while p <= math.sqrt(element):
            if element % p == 0:
                return False
            p += 2
        return True


if __name__ == '__main__':
    main()

Solution (Python):
def sosu(n):
    if n<2:
        return False
    if n==2:
        return True

    if n%2==0:
        return False
    
    for i in range(3,int(n**0.5+1),2):
        if n%i==0:
            return False

    return True
    
n=int(input())
j=0

for i in range(n):
    k=int(input())
    if sosu(k):
        j+=1

print(j)

Solution (Python):
import math

n = int(input())
cnt = 0
for i in range(n):
    num = int(input())
    flag = 1
    if num == 2:
        flag = 1
    elif num % 2 == 0 or num < 2:
        flag = 0
    else:
        for j in range(3, int(math.sqrt(num))+1, 2):
            if num % j == 0:
                flag = 0
                break
    if flag:
        cnt+=1
print(cnt)

Solution (Python):
def judge(n):
    if n == 2:
        return True
    elif n < 2 or n%2 == 0:
        return False
    else:
        i = 3
        while i<=n**0.5:
            if n%i==0:
                return False
            i = i + 2
    return True        

n = int(input())
num = [int(input().strip()) for _ in range(n)]

sum = 0
for i in range(n):
    if judge(num[i]):
        sum = sum + 1
print(sum)

Solution (Python):
import math

def is_prime(n):
    if n <= 1:
        return False

    if n % 2 == 0 and n > 2:
        return False
    
    for i in range(2, math.floor(math.sqrt(n)) + 1):
        if n % i == 0:
            return False
    return True

N = int(input())
ans = 0
for _ in range(N):
    n = int(input())
    if is_prime(n):
        ans += 1
print(ans)

Solution (Python):
import math

result = []

n = int(input())
def isprime(x):
    if x == 2:
        return True
    if x < 2 or x%2 == 0:
        return False
    i = 3
    while i <= math.sqrt(x):
        if x%i == 0:
            return False
        i += 2
    return True

for _ in range(n):
    x = int(input())
    if isprime(x):
        result.append(x)
    
print(len(result))

Solution (Python):
def is_prime(x):
    if x == 2:
        return True
    
    if x < 2 or x % 2 == 0:
        return False
    
    i = 3
    while i <= x ** (1 / 2):
        if x % i == 0:
            return False
        else:
            i += 2
    
    return True

N = int(input())    
counter = 0
for _ in range(N):
    if is_prime(int(input())):
        counter += 1
    else:
        continue

print(counter)

Solution (Python):
N = int(input())

cnt = 0
for _ in range(N):
    n = int(input())
    if n!=2 and n%2 == 0:
        cnt += 1
        continue
    i = 3
    while i**2 <= n:
        if n%i == 0:
            cnt += 1
            break
        i += 2

print(N-cnt)

Solution (Python):
import math
N=int(input())
a=0
for i in range(N):
    n=int(input())
    b=1
    for j in range(2, int(math.sqrt(n))+1):
        if n%j == 0: 
            b=0
            break
    a+=b
print(a)

Solution (Python):
n,*aa = map(int, open(0).read().split())

def is_prime(x):
    if x in [0,1]:
        return False
    if x == 2:
        return True
    if not x%2:
        return False
    for i in range(3,int(x**0.5+1e-8)+1,2):
        if not x%i:
            return False
    return True

print(sum(is_prime(a) for a in aa))

Solution (Python):
import sys
input = sys.stdin.readline


def is_prime(N: int):
    if N == 1:
        return False
    i = 2
    while i * i <= N:
        if N % i == 0:
            return False
        i += 1

    return True


def main():
    N = int(input())
    ans = 0
    for _ in range(N):
        n = int(input())
        if is_prime(n):
            ans += 1
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):

b = 0
n = int(input())
for i in range(n):
    a = int(input())
    c = 0
    if a == 2:
        b += 1
    else:
        for j in range(2,int(a**(1/2))+1):
            if a%j == 0:
                c += 1
                break
        if c == 0:
            b += 1
print(b)

Solution (Python):
import math
def sosu(x):
    if x == 1:
        return False

    for i in range(2, int(math.sqrt(x))+1):
        if x % i == 0:
            return False
    return True

x = []
n = int(input())
for i in range(n):
    k = int(input())
    if sosu(k):
        x.append(k)
print(len(x))

Solution (Python):
import math
def isprime(x):
    if x==2:
        return 1
    elif x<2 or x%2==0:
        return 0
    else:
        i=3
        while i<=math.sqrt(x):
            if x%i==0:
                return 0
            i=i+2
        return 1

n=int(input())
count=0
for i in range(n):
    a=int(input())
    if isprime(a)==1:
        count+=1
    else :
        pass
    
print(count)

Solution (Python):
import math
n=int(input())

a=[int(input()) for i in range(n)]
k=0
l=int(math.sqrt(max(a)))
for i in range(n):
    if a[i]!=1 and a[i]>0:
        for j in range(2,l):
            if a[i]%j==0 and a[i]!=j:
                m=2
                break
            m=1
        if a[i]==2:
            m=1
        if m==1:
            k+=1
print(k)

Solution (Python):
import math

def is_prime(num):
    if num < 2:
        return False
    if num == 2 or num == 3 or num == 5:
        return True
    if num % 2 == 0 or num % 3 == 0 or num % 5 == 0:
        return False

    
    prime = 7
    step = 4
    num_sqrt = math.sqrt(num)
    while prime <= num_sqrt:
        if num % prime == 0:
            return False
        prime += step
        step = 6 - step

    return True


n = int(input())
arr = []
count = 0

for i in range(n):
    arr.append(int(input()))

for j in arr:
    if is_prime(j):
        count += 1
print(count)

Solution (Python):
import math

def is_prime(num):
    if num == 2:
        return True

    if num < 2 or num % 2 == 0:
        return False

    index = 3
    while index <= int(math.sqrt(num)) + 1:
        if num % index == 0:
            return False
        index += 2
    return True


n = int(input())

output = 0
for index in range(n):
    num = int(input())
    if is_prime(num):
        output += 1
print(output)

Solution (Python):
def isPrime(n):
    i = 2
    while i * i <= n:
        if n % i == 0:
            break
        i += 1
    else:
        return True
    return False


if __name__ == '__main__':
    n = int(input())
    cnt = 0
    for _ in range(n):
        if isPrime(int(input())):
            cnt += 1
    print(cnt)

Solution (Python):
n=int(input())
cnt=0
for i in range(n):
  p=int(input())
  for j in range(2,int(p**.5)+1):
    if p%j==0:break
  else:cnt+=1
print(cnt)

Solution (Python):
n = int(input())
P = [int(input()) for i in range(n)]

def isPrime(n):
    s_n = int(n**0.5)
    if n < 2:
        return False
    elif n == 2:
        return True
    elif n % 2 == 0:
        return False
    else:
        for i in range(3, s_n+1, 2):
            if n % i == 0:
                return False
    return True
            
cnt = 0
for i in P:
    cnt += isPrime(i)

print(cnt)

Solution (Python):
import math
m = int(input())
prime = []
for j in range(m):
    n = int(input())
    pri  = []
    
    i = 2
    while i <= math.sqrt(n):
        while n % i == 0:
            pri.append(i)
            n//=i
        i+=1
    
    if n != 1:
        pri.append(n)
        
    if len(pri) == 1:
        prime.append(pri[0])
    
print(len(prime))

Solution (Python):
def judge(x):
    if x == 1:
        return True
    i = 2
    while i**2 <= x:
        if x % i == 0:
            return False
        i += 1
    return True


n = int(input())

ans = 0
for i in range(n):
    x = int(input())
    ans += 1 if judge(x) else 0

print(ans)

Solution (Python):
import math
count = 0
while True:
    try:
        n = int(input())
        if n == 2 or n == 3 or n == 5 or n == 7:
            count += 1
        if n > 3 and n % 2 != 0:
            for i in range(3,int(math.sqrt(n))+1):
                if n % i == 0:
                    break
                elif i == int(math.sqrt(n)):
                    count += 1
    except  EOFError:
        break
print(count)

Solution (Python):
def isprime(N):
    for i in range(2, int(N**0.5)+1):
        if N % i == 0:
            return False
    return True
    
def prime_number(N):
    pn = []
    flg = [0] * (N+1)
    for i in range(2, N+1):
        if flg[i] > 0:
            continue
        for j in range(i, N+1, i):
            flg[j] = 1
        pn.append(i)
    return pn

N = int(input())
cnt = 0
for _ in range(N):
    num = int(input())
    cnt += isprime(num)
print(cnt)

Solution (Python):
import math


N=int(input())

S=[]
T=[]
for i in range(N):
    S.append(int(input()))

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True




for i in range(N):
    
    tmp=is_prime(S[i])
    if tmp==True:
        T.append(S[i])
print(len(T))

Solution (Python):
def is_prime(n):
    if n == 1: return False
    i = 2
    while i**2 <= n:
        if n % i == 0: return False
        i += 1
    return True


n = int(input())
ans = 0

for _ in range(n):
    if is_prime(int(input())):
        ans += 1

print(ans)

Solution (Python):
def judge_prime(x):
    is_prime=True
    for i in range(2,int(x**0.5)+1):
        if x%i==0:
            is_prime=False
    return is_prime

n=int(input())
ans=0
for i in range(n):
    x=int(input())
    if judge_prime(x):
        ans+=1
print(ans)