-
Notifications
You must be signed in to change notification settings - Fork 0
/
Primorial_Prime
50 lines (47 loc) · 1.01 KB
/
Primorial_Prime
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
def check_Prime(a):
if(a==2):
return 1
k=0
for i in range(2,int(a/2)+1):
if(a%i==0):
k=k+1
break
if(k<=0):
return 1
else:
return 0
def check_Primorial(a):
if(a<8):
return 1
p=a/2
if(p!=int(p)):
return 0
while(p>0):
for i in range(3,int(a/2)+1):
f=0
for j in range(2,i):
if(i%j==0):
f=1
break
if(f==0):
p=p/i
if(p!=int(p)):
p=0
break
if(p==1):
return 1
return 0
p=int(input("Enter start"))
q=int(input("Enter end"))
if p==1:
p=2
for i in range(p,q):
if(check_Prime(i)):
x=0
x=check_Primorial(i-1)
if x==1:
print(i)
else:
x=check_Primorial(i+1)
if x==1:
print(i)