A Prime Counting Sequence and Andrica’s Conjecture

In this post I want to discuss a prime counting sequence similar to OEIS sequence A066888. The sequence A066888 counts the number of primes between 2 consecutive triangular numbers. On the OEIS page of the sequence there is a conjecture that says that there is at least one prime number between 2 consecutive triangular numbers. I want to create a similar sequence of integer intervals that always contain at least one prime number and with integer intervals smaller than the ones created by the triangular numbers.

If p and q are 2 consecutive prime numbers (q being the larger integer), Andrica’s conjecture says that the square root of q minus the square root of p < 1. Assuming each interval contains a prime number, I want to make the intervals small enough so that we know that the primes inside 2 consecutive intervals meet the criteria set by Andrica’s conjecture.

The Prime Counting Sequence

Triangular numbers can be generated using the formula n(n+1)/2. I want to generate smaller intervals so I decided to look for primes such that ceilling((n)(n+1)/sqrt(2*pi*e))< prime numbers <= ceilling((n+1)(n+2)/sqrt(2*pi*e)). A more elegant version of the formula for the interval is shown below.

The tables below show what prime numbers are in each interval for n=1 to 50.

All the intervals up to 125 seem to have at least 1 prime number. The last interval to have only 1 prime number was for n=46.

As n goes to infinity, the upper boundary of an interval and the lower boundary of the previous interval meet the criteria set by Andrica’s conjecture. The limit function can be seen below.

The limit function is approximately 0.9838, which is just smaller than 1. If each interval has a prime number, then we know that the primes inside 2 consecutive intervals meet the criteria set by Andrica’s conjecture (even if they are not consecutive primes). This means that the conjecture that all the intervals contain at least 1 prime number is stronger than Andrica’s conjecture. If the interval conjecture is true , it also means that Andrica’s conjecture is true. However, Andrica’s conjecture can be true, while my interval conjecture can be false. This is because there is the possibility that 2 consecutive primes can skip an interval, while still meeting the Andrica criteria. There is even the possibility that 2 consecutive primes have 2 empty intervals between them while still meeting the Andrica criteria, because the limit 0.9838 is slightly smaller than 1.


The idea of this post was inspired by sequence A066888 and the conjecture mentioned on its page. However, I wanted to create a sequence of smaller intervals that could guarantee that Andrica’s criteria are met when 2 primes are inside 2 consecutive intervals (even when the 2 primes are not consecutive).

Of course, proving that each interval in my sequence or similar sequences always contain prime numbers is also a hard problem. The main idea of this post is to show an alternative method of attacking Andrica’s conjecture or similar conjectures . You can also look at Legendre’s conjecture, but I believe that it’s weaker than Andrica’s conjecture.

It’s very possible that there exists a sequence or sequences with much smaller intervals that always contain a prime number (for n greater than some integer k). How small can such intervals be made using basic algebraic operations?

If you look at the differences between the square roots of consecutive primes as primes get bigger and bigger, the differences seem to get much smaller than 0.5. Is there a way to slowly adjust the interval boundaries to the lower square root gaps?

If you are interested in these types of prime conjectures, you should visit the Prime Puzzles website. The website has a lot of problems, puzzles and conjectures related to prime numbers. You can even send solutions , partial solutions or relevant comments.

Leave a comment

Your email address will not be published. Required fields are marked *