Given a number $2n$, where $n$ is an integer greater than $2$, how many odd composites $x ∈ [9,n]$ share at least one odd prime factor less than or equal to $n$ or have the same remainder with $2n$ when divided by at least one odd prime less than or equal to $n$? Please express your answer by defining the function $f(2n)$ which tells this number based on $n$. If your answer is approximate, please provide a lower and upper bound, especially for $\pi(n)$, and refrain from using probabilities as best you can. Leaving $\pi(n)$ without approximating it is fine too.
Examples of what the function should evaluate to:
$f(18) = 1, f(30)=2, f(32)=0, f(42)=3, f(46) = 1, f(66) = 5$
$f(18)$ evaluates to $1$ because there is one odd composite less than or equal to $n$, which is $9$ in this case; $9$. $18$ and $9$ both share the factor 3.
$f(30)$ evaluates to $2$ because there are two odd composites less than or equal to $15$; $9, 15$. Since $30$ is divisible by $3$ and $5$, and $9$ is divisible by $3$, and $15$ is divisible by $3$ and $5$, $f(30)$ evaluates to $2$.
$f(32)$ evaluates to $0$ because no composite shares a remainder with it when divided by any prime less than or equal to $n$.
So far, I know that there are $\lfloor\frac{n}{2}\rfloor - \pi(n) + 1 $ odd composites up to $n$, but I haven't been able to get much farther.
EDIT:
I have been made aware that this question is the same as asking, find a function $f(2n)$ that increases by one for a value $2n$ every time $(2n-x)$ can be divided by an odd prime, where $x$ is any odd composite less than or equal to $n$.