# How many integers $i$ make $\frac{2n - 2i - p - 1}{2p}$ a positive integer for fixed $n, p$

Please define a function $g(n,p)$ that gives the amount of positive integer $i$s that make the following expression a positive integer: $\frac{2n - 2i - p - 1}{2p}$, where $n$ is a given integer, where $p$ is some prime $2 \lt p \le n$, and where $i$ is some integer less than $n$. In case you use $\pi(n)$ for the prime counting function, please do not approximate it but leave it as $\pi(n)$.

• @Peter When would this be the case? In a limit? Apr 16, 2017 at 16:11
• Because $2i \le 2n-p-1$! Apr 16, 2017 at 16:18
• @Ghartal Did not notice that the expression should be positive. Apr 16, 2017 at 16:22
• @Ghartal I forgot to bound $i$. I'll fix that. Apr 16, 2017 at 16:26

If $p$ is fixed why would we need the prime counting function? Just work with the numerator $\bmod {2p}$. If $p=2$ there are no solutions because the numerator is odd. The solutions for $i$ will recur at intervals of $p$. The highest $i$ will solve $2n-2i-p-1=2p$ or $i=\frac 12(2n-3p-1).$ Now just divide that by $p$ and discard the remainder to find how many there are.
• This is pretty clear, thanks. Just to clarify, "Now just divide that by $p$ and ..." What does "that" refer to? Apr 16, 2017 at 16:40
• The maximum $i$ Apr 16, 2017 at 18:01
• So $g(n,p) = \lfloor \frac{2n-3p-1}{2p} \rfloor$? Apr 16, 2017 at 18:45