# Proving that all numbers between two numbers are composite

I am having trouble with this problem:

Assume $p_1, p_2 \ldots p_{n+1}$ be the first $n+1$ primes in order. Prove that every number between $(p_1\cdot p_2 \cdot \ldots \cdot p_{n}) + 1$ (exclusive) and $(p_1 \cdot p_2 \cdot p_3 \cdot \ldots \cdot p_n + p_{n+1}) − 1$ (inclusive) is composite. How does this show that there are gaps of arbitrary length in the sequence of primes?

I saw a question and answer which I will link to below that stated the same question, but because the asker made an error and later fixed it this caused the response to look incorrect to me. I would appreciate if someone could offer me some guidance on this question without giving the full solution.

Thanks!

Please note I have already viewed this question: Prove that every number between two factors of primes is composite.

• If I read the statement correctly, it is not true. Let $n=2$, then $p_1p_2+1=7$ is prime. Also $p_1p_2+p_3-1=11$ is prime – Ross Millikan Oct 22 '14 at 4:24
• @Dale M: I think the first number ended with $p_n+1$, not $p_{n+1}$. user186358, please confirm or deny. Thanks. – Ross Millikan Oct 22 '14 at 4:25
• It did, sorry I just accepted his edit without inspecting it carefully enough – user186358 Oct 22 '14 at 4:26
• @Adriano: The second number in the original post had $+p_{n+1}-1$, not $\cdot p_{n+1}-1$. user 186358 please confirm or deny. Thanks. – Ross Millikan Oct 22 '14 at 4:28
• Also pn+1 is added to the earlier term – user186358 Oct 22 '14 at 4:28

Let $p_n\#=p_1\cdot p_2\cdots p_{n}$ be the product of the first $n$ primes. Consider $p_n\#+k$, where $2 \le k < p_{n+1}$. Since $k<p_{n+1}$, all its prime factors are among the first $n$ primes; in particular, $p_i$ must divide $k$ for some $i\le n$. So, since $p_i$ also divides $p_n\#$, $p_i$ divides $p_n\#+k$; therefore $p_n\#+k$ is composite. This shows that there is a run of at least $p_{n+1}-1$ composite numbers beginning at $p_n\#+2$.