$p(m)$ is the number of distinct prime divisors of a positive integer $m>1$ and $f(m)$ is the $\bigg \lfloor \frac{p(m)+1}{2}\bigg \rfloor$ th smallest prime divisor of $m$. Find all positive integers $n$ satisfying the equation: $$f(n^2+2) + f(n^2+5) = 2n-4$$
1. **Initial Considerations:**
   - Given \( p(m) \) is the number of distinct prime divisors of a positive integer \( m > 1 \).
   - \( f(m) \) is the \( \left\lfloor \frac{p(m) + 1}{2} \right\rfloor \)-th smallest prime divisor of \( m \).
   - We need to find all positive integers \( n \) satisfying the equation:
     \[
     f(n^2 + 2) + f(n^2 + 5) = 2n - 4
     \]

2. **Lower Bound for \( n \):**
   - Since \( f(n^2 + 2) \) and \( f(n^2 + 5) \) are at least the smallest prime divisors of \( n^2 + 2 \) and \( n^2 + 5 \) respectively, we have:
     \[
     f(n^2 + 2) + f(n^2 + 5) \geq 2 + 3 = 5
     \]
   - Given \( f(n^2 + 2) + f(n^2 + 5) = 2n - 4 \), we get:
     \[
     2n - 4 \geq 5 \implies 2n \geq 9 \implies n \geq 5
     \]

3. **Verification for \( n = 5 \):**
   - For \( n = 5 \):
     \[
     n^2 + 2 = 25 + 2 = 27 \quad \text{and} \quad n^2 + 5 = 25 + 5 = 30
     \]
   - Prime divisors of 27 are \( 3 \) (with multiplicity 3), so \( f(27) = 3 \).
   - Prime divisors of 30 are \( 2, 3, 5 \), so \( f(30) = 3 \) (since \( \left\lfloor \frac{3+1}{2} \right\rfloor = 2 \)-nd smallest prime divisor is 3).
   - Therefore:
     \[
     f(27) + f(30) = 3 + 3 = 6
     \]
   - And:
     \[
     2n - 4 = 2 \cdot 5 - 4 = 6
     \]
   - Thus, \( n = 5 \) satisfies the equation.

4. **Contradiction for \( n \geq 6 \):**
   - Assume \( n \geq 6 \) satisfies the equation:
     \[
     f(n^2 + 2) + f(n^2 + 5) = 2n - 4 \quad \cdots (\heartsuit)
     \]
   - We need to show that \( f(n^2 + 2) \neq n, n-1 \) and \( f(n^2 + 5) \neq n-1, n-2 \):
     - If \( n = f(n^2 + 2) \), then \( n \mid n^2 + 2 \implies n \mid 2 \), which is impossible for \( n \geq 6 \).
     - If \( n-1 = f(n^2 + 2) \), then \( n-1 \mid n^2 + 2 \implies n-1 \mid 3 \), which is impossible for \( n \geq 6 \).
     - If \( n-2 = f(n^2 + 5) \), then \( n-2 \mid n^2 + 5 \implies n-2 \mid 9 \), which is impossible for \( n \geq 6 \).
     - If \( n-1 = f(n^2 + 5) \), then \( n-1 \mid n^2 + 5 \implies n-1 \mid 6 \), which is impossible for \( n \geq 6 \).

5. **Case Analysis:**
   - **Case 1: \( 2 \mid n^2 + 2 \)**
     - \( p(n^2 + 2) \geq 2 \) because \( 4 \nmid n^2 + 2 \).
     - If \( n \leq f(n^2 + 2) \), then \( n(n+2) \leq n^2 + 2 \), which is impossible.
     - Thus, \( f(n^2 + 2) \leq n-2 \).
     - From \( (\heartsuit) \), \( f(n^2 + 5) \geq n-2 \).
     - If \( p(n^2 + 5) \geq 2 \), then \( n^2 + 5 \geq n(n+2) \), which is impossible.
     - Thus, \( p(n^2 + 5) = 1 \), implying \( n^2 + 5 = q^k \) for some prime \( q \geq n+1 \).
     - Since \( n^2 + 5 < (n+1)^2 \), we must have \( k = 1 \), but then \( f(n^2 + 5) = n^2 + 5 \), which is impossible.

   - **Case 2: \( 2 \mid n^2 + 5 \)**
     - \( p(n^2 + 5) \geq 2 \) because \( 4 \nmid n^2 + 5 \).
     - If \( n \leq f(n^2 + 5) \), then \( n(n+2) \leq n^2 + 5 \), which is impossible.
     - Thus, \( f(n^2 + 5) \leq n-3 \).
     - From \( (\heartsuit) \), \( f(n^2 + 2) \geq n-1 \).
     - If \( p(n^2 + 2) \geq 2 \), then \( n^2 + 2 \geq (n+1)(n+3) \), which is impossible.
     - Thus, \( p(n^2 + 2) = 1 \), implying \( n^2 + 2 = q^k \) for some prime \( q \geq n+1 \).
     - Since \( n^2 + 2 < (n+1)^2 \), we must have \( k = 1 \), but then \( f(n^2 + 2) = n^2 + 2 \), which is impossible.

Conclusion: \( n \) satisfies the given equation if and only if \( \boxed{n = 5} \).