# Untitled

unknown
python
7 months ago
1.4 kB
1
Indexable
Never
```from math import *

# check if a number is prime
def is_prime(n):
# 0 and 1 are not prime numbers
# we return false directly
if n<=1:
return False
# we start from 2 because 1 always devide any number
# +1  because we need to reach sqrt(n) and range exclude last element
for i in range(2, int(sqrt(n))+1):
# we found a divider that is diffrenet from 1 and n
if n%i == 0 :
return False
# after we finish the loop ,  that mean there is no diveder for n !=1 and !=n
return True

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

# n=p*k
def semi_prime(n):
for i in range ( 2, int(n/2) + 1):
if n%i ==0 :
p=i
k=n/i
if is_prime(p) and is_prime(k):
return True
return False

#print(semi_prime(24))

#n=24 -> [1,2,3,4,6,8,12,24]
def dividers(n):
t=[]
for i in  range (1,int(n/2)+1):
if n%i==0:
p=i
k=int(n/i)
t.append(p)
return t
print(dividers(24))

t=[0]*10
def n():
n= int(input("enter table size"))
while( n>10 ):
n= int(input("enter table size"))
return n
def fill(t,n):
for i in range(0,n):
t[i]=int(input("enter element"))

fill(t,n())

```