$a)$ Solve over the positive integers $3^x=x+2.$
$b)$ Find pairs $(x,y)\in\mathbb{N}\times\mathbb{N}$ such that $(x+3^y)$ and $(y+3^x)$ are consecutive.
### Part (a)
We need to solve the equation \(3^x = x + 2\) over the positive integers.

1. **Check small values of \(x\):**
   - For \(x = 1\):
     \[
     3^1 = 3 \quad \text{and} \quad 1 + 2 = 3
     \]
     Thus, \(x = 1\) is a solution.

2. **Analyze for \(x > 1\):**
   - For \(x > 1\), we need to compare the left-hand side (LHS) and the right-hand side (RHS) of the equation.
   - The LHS is \(3^x\), which grows exponentially.
   - The RHS is \(x + 2\), which grows linearly.
   - For \(x > 1\), \(3^x\) grows much faster than \(x + 2\).

3. **Conclusion:**
   - Since \(3^x\) grows exponentially and \(x + 2\) grows linearly, for \(x > 1\), \(3^x > x + 2\).
   - Therefore, the only solution in positive integers is \(x = 1\).

### Part (b)
We need to find pairs \((x, y) \in \mathbb{N} \times \mathbb{N}\) such that \((x + 3^y)\) and \((y + 3^x)\) are consecutive integers.

1. **Set up the equation:**
   - If \((x + 3^y)\) and \((y + 3^x)\) are consecutive, then:
     \[
     x + 3^y + 1 = y + 3^x \quad \text{or} \quad y + 3^x + 1 = x + 3^y
     \]
   - Without loss of generality, consider:
     \[
     x + 3^y + 1 = y + 3^x
     \]
   - Rearrange to get:
     \[
     x - y + 3^y + 1 = 3^x
     \]

2. **Case \(x = y\):**
   - If \(x = y\), then:
     \[
     x + 3^x + 1 = x + 3^x \implies 1 = 0
     \]
     This is a contradiction, so \(x \neq y\).

3. **Case \(y > x\):**
   - Let \(y = x + n\) where \(n > 0\):
     \[
     x + 3^{x+n} + 1 = x + n + 3^x
     \]
     Simplify to:
     \[
     3^{x+n} + 1 = n + 3^x
     \]
     Rearrange to:
     \[
     3^{x+n} = n + 3^x - 1
     \]
   - For \(n > 1\), \(3^{x+n}\) grows much faster than \(n + 3^x - 1\), leading to a contradiction.

4. **Case \(x > y\):**
   - Let \(x = y + n\) where \(n > 0\):
     \[
     y + n + 3^y + 1 = y + 3^{y+n}
     \]
     Simplify to:
     \[
     n + 3^y + 1 = 3^{y+n}
     \]
     Rearrange to:
     \[
     3^{y+n} = n + 3^y + 1
     \]
   - For \(n = 1\):
     \[
     3^{y+1} = 3^y + 2
     \]
     This implies:
     \[
     3 \cdot 3^y = 3^y + 2 \implies 2 \cdot 3^y = 2 \implies 3^y = 1
     \]
     Thus, \(y = 0\), but \(0 \notin \mathbb{N}\).

   - For \(n > 1\), \(3^{y+n}\) grows much faster than \(n + 3^y + 1\), leading to a contradiction.

### Conclusion:
There are no pairs \((x, y) \in \mathbb{N} \times \mathbb{N}\) such that \((x + 3^y)\) and \((y + 3^x)\) are consecutive integers.

The final answer is \( \boxed{ x = 1 } \) for part (a) and no pairs \((x, y)\) for part (b).