A Math oriented question asked at a recent Amazon interview.

**Q :**Given any twin prime pair, prove that the number between the twin primes is always divisible by 6.**Twin Prime**(from Wiipedia) :A twin prime is a prime number that differs from another prime number by two. Except for the pair (2, 3), this is the smallest possible difference between two primes. Some examples of twin prime pairs are (3, 5), (5, 7), (11, 13), (17, 19), (29, 31), (41, 43), ... (821, 823), etc. Sometimes the term twin prime is used for a pair of twin primes; an alternative name for this is prime twin.

## 3 comments:

This is actually more simple that it looks.

Since the numbers are prime, they are odd.

Therefore the number in between HAS to be even and divisible by 2.

Given 3 consecutive numbers, one of them has to be divisible by 3.

Since we are considering twin prime numbers, both the prime numbers are indivisible by 3, thus making a number in between divisible by 3.

If a number is divisible by 2 and 3, it is divisible by 6. :-)

If a mathematical proof is required, we can use induction.

The only exception to this rule is the first pair of twin primes, which is (3,5) since both the numbers are < 6

Absolutely @SV.

About proof by Induction - can you give it a try . I was not able to come up with a "N+1" case.

Post a Comment