Find all odd positive integers $n>1$ such that there is a permutation $a_1, a_2, a_3, \ldots, a_n$ of the numbers $1, 2,3, \ldots, n$ where $n$ divides one of the numbers $a_k^2 - a_{k+1} - 1$ and $a_k^2 - a_{k+1} + 1$ for each $k$, $1 \leq k \leq n$ (we assume $a_{n+1}=a_1$).
1. **Initial Setup and Problem Restatement:**
   We need to find all odd positive integers \( n > 1 \) such that there exists a permutation \( a_1, a_2, \ldots, a_n \) of the numbers \( 1, 2, \ldots, n \) where \( n \) divides one of the numbers \( a_k^2 - a_{k+1} - 1 \) and \( a_k^2 - a_{k+1} + 1 \) for each \( k \), \( 1 \leq k \leq n \) (with \( a_{n+1} = a_1 \)).

2. **Analyzing the Conditions:**
   We want \( a_{k+1} \equiv a_k^2 \pm 1 \pmod{n} \). Since \( a_k \) is a permutation of \( \{1, 2, \ldots, n\} \), the left-hand side attains \( n \) distinct values. Let \( A \) be the number of different squares modulo \( n \). The right-hand side can attain at most \( 2A \) different values. Therefore, we have:
   \[
   2A \geq n \implies A \geq \frac{n+1}{2}
   \]

3. **Counting Squares Modulo \( n \):**
   For an odd \( n \), there are at most \( \frac{n+1}{2} \) squares modulo \( n \) because \( x^2 \equiv (n-x)^2 \pmod{n} \) for \( x = 0, 1, \ldots, \frac{n-1}{2} \).

4. **Composite \( n \):**
   If \( n \) is composite and odd with a prime divisor \( p \), then \( x^2 \equiv y^2 \pmod{n} \) with \( x \not\equiv \pm y \) is possible. This implies:
   \[
   x - y = p \quad \text{and} \quad x + y = \frac{n}{p}
   \]
   Solving these, we get:
   \[
   x = \frac{p + \frac{n}{p}}{2} \quad \text{and} \quad y = \frac{\frac{n}{p} - p}{2}
   \]
   This results in two additional equal squares, reducing the number of distinct squares modulo \( n \) to at most \( \frac{n-1}{2} \), which contradicts \( A \geq \frac{n+1}{2} \). Hence, \( n \) must be prime.

5. **Prime \( n \):**
   For prime \( n \), we cannot have all \( \pm \) to be \( + \) or all to be \( - \) because the right-hand side would attain just \( \frac{n+1}{2} < n \) different values.

6. **Summing the Conditions:**
   Summing \( a_{k+1} \equiv a_k^2 \pm 1 \pmod{n} \) over all \( k \), let \( B \) be the sum of the \( \pm 1 \)'s. Since the \( a_k \)'s permute \( \{1, 2, \ldots, n\} \), we have:
   \[
   \sum_{i=1}^{n} a_i \equiv \frac{n(n+1)}{2} \pmod{n}
   \]
   and
   \[
   \sum_{i=1}^{n} a_i^2 \equiv \frac{n(n+1)(2n+1)}{6} \pmod{n}
   \]
   Therefore,
   \[
   3n(n+1) \equiv n(n+1)(2n+1) + 6B \pmod{n}
   \]
   This implies \( n \) must divide \( 6B \). For prime \( n \geq 5 \), this forces \( B = 0 \), which is impossible since \( B \) must be odd.

7. **Checking \( n = 3 \):**
   For \( n = 3 \), we check the permutation \( (1, 2, 3) \):
   \[
   a_1 = 1, a_2 = 2, a_3 = 3
   \]
   We need:
   \[
   1^2 - 2 \pm 1 \equiv 0 \pmod{3}, \quad 2^2 - 3 \pm 1 \equiv 0 \pmod{3}, \quad 3^2 - 1 \pm 1 \equiv 0 \pmod{3}
   \]
   These conditions are satisfied, so \( n = 3 \) is a solution.

The final answer is \( \boxed{ n = 3 } \).