Suppose that $m$ and $k$ are positive integers. Determine the number of sequences $x_1, x_2, x_3, \dots , x_{m-1}, x_m$ with

[list]
[*]$x_i$ an integer for $i = 1, 2, 3, \dots , m$,
[*]$1\le x_i \le k$ for $i = 1, 2, 3, \dots , m$,
[*]$x_1\neq x_m$, and
[*]no two consecutive terms equal.[/list]
1. **Define the sequences and initial conditions:**
   Let \( S_m^k \) be the number of sequences \( x_1, x_2, \ldots, x_m \) that satisfy the given conditions:
   - \( x_i \) is an integer for \( i = 1, 2, \ldots, m \),
   - \( 1 \le x_i \le k \) for \( i = 1, 2, \ldots, m \),
   - \( x_1 \neq x_m \),
   - No two consecutive terms are equal.

   Let \( T_m^k \) be the number of sequences where \( x_m = x_1 \) instead of \( x_m \neq x_1 \).

2. **Establish base cases:**
   - For \( m = 1 \):
     \[
     S_1^k = 0 \quad \text{(since \( x_1 \neq x_1 \) is impossible)}
     \]
     \[
     T_1^k = k \quad \text{(since any of the \( k \) values is valid)}
     \]

3. **Recurrence relations:**
   - For \( S_{m+1}^k \):
     \[
     S_{m+1}^k = S_m^k (k-2) + T_m^k (k-1)
     \]
     This is because:
     - If \( x_{m+1} \neq x_1 \), then \( x_{m+1} \) can be any of the \( k-1 \) values except \( x_1 \).
     - If \( x_{m+1} = x_1 \), then \( x_{m+1} \) can be any of the \( k-2 \) values except \( x_1 \) and \( x_m \).

   - For \( T_{m+1}^k \):
     \[
     T_{m+1}^k = S_m^k
     \]
     This is because:
     - If \( x_{m+1} = x_1 \), then the sequence up to \( x_m \) must satisfy \( x_1 \neq x_m \).

4. **Solve the recurrence relations:**
   - From the recurrence relation for \( T_{m+1}^k \):
     \[
     T_{m+1}^k = S_m^k
     \]
     - For \( m = 1 \):
       \[
       T_2^k = S_1^k = 0
       \]
     - For \( m = 2 \):
       \[
       T_3^k = S_2^k
       \]
     - And so on.

   - From the recurrence relation for \( S_{m+1}^k \):
     \[
     S_{m+1}^k = S_m^k (k-2) + T_m^k (k-1)
     \]
     - For \( m = 1 \):
       \[
       S_2^k = S_1^k (k-2) + T_1^k (k-1) = 0 \cdot (k-2) + k \cdot (k-1) = k(k-1)
       \]
     - For \( m = 2 \):
       \[
       S_3^k = S_2^k (k-2) + T_2^k (k-1) = k(k-1)(k-2) + 0 \cdot (k-1) = k(k-1)(k-2)
       \]
     - And so on.

5. **General solution:**
   - By solving the recurrence relations, we find:
     \[
     S_m^k = (k-1)(-1)^m + (k-1)^m
     \]

The final answer is \(\boxed{S_m^k = (k-1)(-1)^m + (k-1)^m}\)