a,b=input("Enter the Range Seprated by space ->" ).split(' ')
primes=list()
for i in range(int(a),int(int(b)+1)):
flag=1
for j in range(2,i):
if i%j==0:
flag=0
break
if flag==1:
primes.append(i)
count=0
for j in primes:
if j+6 in primes:
count+=1
print(count).
example: 4 40
output 7
primes=list()
for i in range(int(a),int(int(b)+1)):
flag=1
for j in range(2,i):
if i%j==0:
flag=0
break
if flag==1:
primes.append(i)
count=0
for j in primes:
if j+6 in primes:
count+=1
print(count).
example: 4 40
output 7
Comments
Post a Comment
share your thoughts ....