I am trying to find the maximum gap between any prime and the nearest prime number (whether smaller or bigger)? Here is what I have:
Assuming: I don’t know whether any of the multiples that are smaller than $p$ is prime or not.
Assuming: $p$ is any prime number and $\Bbb N$ is for natural numbers: $\{a_n : n≥1\in\Bbb N\}$ and $\{b_m : m≥0\in\Bbb N\}$:
If $\frac{p+1}{2}$ is odd:
$$ A = 2^{b_m}⋅\prod_{k=2}^{\frac{\frac{p+1}{2} +1}{2}}(2k-1)^{a_n}$$
$$ B = \prod_{k=\frac{\frac{p+1}{2} +1}{2}+1}^{\frac{p+1}{2}}(2k-1)^{a_n}$$
If $\frac{p+1}{2}$ is even:
$$ A = 2^{b_m}⋅\prod_{k=2}^{\frac{p+1}{4}+1}(2k-1)^{a_n}$$
$$ B = \prod_{k=\frac{p+1}{4}+2}^{\frac{p+1}{2}}(2k-1)^{a_n}$$
For $p > 7$, If $p \equiv 1\;\;(\!\!\!\mod{3})$:
$$ C = \prod_{k=2}^{\frac{p-1}{6}}(2k-1)$$
For $p > 7$, If $p \equiv 2\;\;(\!\!\!\mod{3})$:
$$ C = \prod_{k=2}^{\frac{p+1}{6}}(2k-1)$$
Here are my reasonings in which one of the following $2$ options must be true:
option $1$)
If $|A-B|=X$, then $X$ is divisible by $C$ and at least one other prime that is greater than $p$ and not a multiple of $C$.
Example:
$p = 31$
$A = 2^5⋅3^1⋅5^2⋅7^1⋅9^1⋅11^1⋅13^1⋅15^1⋅17^1=5513508000$
$B = 19^1⋅21^1⋅23^1⋅25^1⋅27^1⋅29^1⋅31^1=5568833025$
$C = 3⋅5⋅7⋅9 = 945$
(*$B$ can only have prime numbers or multiples of $C$ times $3$)
$\frac {(|5513508000 - 5568833025|)} {945} = 58545$
$58545$ can be maybe further divided by either $3$ or $5$ or $7$ or $9$ but eventually there will be a result that has at least one prime multiple greater than $p$, and definitely smaller or equal to $58545$
In this example we can further divide $58545$ by $3$s and $5$s: $\frac {58545}{45}=1301$, $1301$ may be a prime number and if not, it will for sure have a prime factor bigger than $p$. In the case of $1301$, $1301$ is a prime number.
$$OR$$
Option $2$) (if option $1$ is wrong)
If $|A-B|=X$, then $X$ is divisible by $C$ and only by some other multiples of $C$. In this case: there must be at least one prime multiple in $A$ that is bigger than any prime multiple of $C$ and smaller than any multiple of $B$ and thus smaller than $p$.
Example:
$p = 11$
$A = 2^0⋅3^1⋅5^1⋅7^1=105$
$B = 9^1⋅11^1 = 99$
$C = 2⋅3$
(*$B$ can only have prime numbers or multiples of $C$ times $3$)
$\frac {(|105- 99|)} {3} = 2$
In this example $2$ divides by only $2$ which is a multiple of $C$
That means that there is at least one prime multiple in $A$ that is greater than any prime multiple in $C$ and smaller than $B$ and thus smaller than $p$.
If there was no other prime multiple in $A$ greater than any multiple in $C$, the only way to achieve an $X$ with only the multiples of $C$ would be if all the multiples in $A$ and $B$ were both only multiples of $C$, and we know that it is not true because $p$ which is a multiple of $B$ is not a multiple of $C$
In this example we have $5$ and $7$ that are greater than $3$ and smaller than $11$. and thus we can conclude that there must be a prime bigger than $3$ that is closer to $p=11$
Am i correct with my reasoning?
Thank you in advance!