# FINDING NUMBER OF PRIME PAIRS WHOSE DIFFERENCE IS 6 USING PYTHON

In this python project, we will find the number of prime pairs that are present between the given inclusive range with the difference of 6.

Prime number :

A prime number is a number having exactly two factors. If p is a prime, then its only factors are necessarily 1 and p itself. In this program,                      we will find the number of prime pairs with a difference of 6 is present in the given inclusive range using python.For example, the given range                  is 4,30 then all possible pairs are (5,11),(7,13),(11,17),(13,19),(17,23),(23,29) i.e 6 pairs with a difference of 6.

Example :

Input   :4 30

Output :6

Input   :101 500

Output :30

Input   :1000 2000

Output :54

• Pavan :

• Amit Shukla
• n = int(input("enter the lower range\n"))

`m = int(input("enter the upper range\n"))prime = []pair = []for number in range(n, m+1):    if number > 1:        for i in range(2, number):            if number % i == 0:                break        else:            prime += [number]print(prime)for j in prime:    if j + 6 in prime:        x = j + 6        if j + 6 in prime and x in prime:          pair += [(j, x)]print(f"The no of pair if {len(pair)} and the prime pairs are {pair}")`

Submitted by Akula Arjun (Arjun)

Download packets of source code on Coders Packet