Is it possible to come up with a formula for upper bound for this? Consider a sieve, where the only numbers left are $n \equiv 5 mod (6)$
So the sieve has 5, 11, 17, 23...
Where the gap is uniform and is 6, initially.
Now we'll continue to sieve out the multiples of prime numbers starting from 5.
Now 35, 65, 95... are sieved out
After this the gap among the numbers is no more uniform and the max gap is 12, min gap is 6.
If we go on sieveing out multiples of prime numbers, at any stage is there a way to estimate the upper bound of max gap among the numbers left, after multiples of all the numbers, till a given number is sieved out?
Let the function be $G(n)$ where $n$ is the prime number, till which it is sieved.
So $G(5) = 12$
Is there any way where we can come up with a formula for $G(n)$?
If not an exact formula is it atleast possible to calculate the upper bound?

Some observations:

*

*$G(n)$ is always multiple of 6 and it goes on increasing.


*$G(n)$ where $n$ is not a prime number is same as $G(m)$ where $m$ is a prime number just less than $n$. For eg: $G(6) = G(5)$
 A: I will do $G(7),G(17)$ to illustrate a point, for $G(7)$ we need $x$ such that $6x+5 = 0 \mod 5$ and $ 6(x+1)+5=0 \mod 7$ since we are dealing with primes and $gcd(6,p)=1$ for $p\geq 5$ prime number then there is a solution using Chinese remainder theorem and $x= 25$ so $6*25+5 , 6*26+5 = 155,161$ are sieved out, and in general for $p_k = n$ we can make a system of $\pi(n)-1$(excluding 2,3) equations meaning we can sieve out $\pi(n)-1$ consecutive multiples of $6$ and so we have that $ G(n) \geq 6(\pi(n)-1)$ (this is a lower bound, which is not a tight one as we will see in the next example).
For $G(17)$ we need $x$ such that $6x+5=0 \mod 5$ and $6(x+1)+5 =0 \mod 7$ and $ 6(x+2)+5 = 0 \mod 11$ and $6(x+3)+5 = 0 \mod 13$ and $ 6(x+4)+5= 0 \mod 17$ and
we can do it one more time because $6(x+5)+5 = 0 \mod 5$ and $x=55010$ so as an upper bound we have that $ G(n) \leq 6(\pi(n)-1 +\sum \limits_{i=3}^{\pi(n)} \lfloor \frac{\pi(n)-2}{p_i}\rfloor)$  which is approximately $ \approx 6 \pi(n) (1+ \ln \ln n + M -\frac{1}{2}-\frac{1}{3}) $ or $ \approx 6 \pi(n ) ( \ln \ln n + 0.428163879514309450422093505275362525718) $ where $M\approx 0.2614972128476427837554268386086958590516$ (Mertens constant)  (This is upper bound because the congruences system might overlap i don't know)
But i think the upper bound is tight and furthermore i think it's the correct answer if one could prove that there is a combination of congruences system equations which don't overlap (i might be wrong) but these are the lower and upper bounds.
I really think the upper bound is the actual answer from the tests i ran on java, but NT and numerical evidences are arch nemesis.
