For positive integer $n$, define $S_n$ to be the minimum value of the sum \[ \sum_{k=1}^n \sqrt{(2k-1)^2+a_k^2}, \] where $a_1,a_2,\ldots,a_n$ are positive real numbers whose sum is 17. There is a unique positive integer $n$ for which $S_n$ is also an integer. Find this $n$.
1. **Geometric Interpretation**: Consider \( n \) right triangles joined at their vertices, with bases \( a_1, a_2, \ldots, a_n \) and heights \( 1, 3, \ldots, 2n-1 \). The sum of their hypotenuses is the value of \( S_n \). The minimum value of \( S_n \) is the length of the straight line connecting the bottom vertex of the first right triangle and the top vertex of the last right triangle.

2. **Expression for \( S_n \)**: The minimum value of \( S_n \) can be expressed as:
   \[
   S_n \ge \sqrt{\left(\sum_{k=1}^n (2k-1)\right)^2 + \left(\sum_{k=1}^n a_k\right)^2}
   \]
   Since the sum of the first \( n \) odd integers is \( n^2 \) and the sum of \( a_1, a_2, \ldots, a_n \) is 17, we get:
   \[
   S_n \ge \sqrt{17^2 + n^2}
   \]

3. **Condition for \( S_n \) to be an integer**: For \( S_n \) to be an integer, the expression under the square root must be a perfect square. Thus, we need:
   \[
   17^2 + n^4 = m^2
   \]
   for some integer \( m \). This can be rewritten as:
   \[
   m^2 - n^4 = 289
   \]
   This is a difference of squares, so we can factor it as:
   \[
   (m - n^2)(m + n^2) = 289
   \]

4. **Solving the equation**: The factor pairs of 289 are \( (1, 289) \) and \( (17, 17) \). We consider each pair:
   - For \( (m - n^2) = 1 \) and \( (m + n^2) = 289 \):
     \[
     m - n^2 = 1 \quad \text{and} \quad m + n^2 = 289
     \]
     Adding these equations, we get:
     \[
     2m = 290 \implies m = 145
     \]
     Subtracting these equations, we get:
     \[
     2n^2 = 288 \implies n^2 = 144 \implies n = 12
     \]

5. **Verification**: We need to verify that \( n = 12 \) is the only solution. The other factor pair \( (17, 17) \) does not yield a valid solution because it would imply \( n = 0 \), which is not a positive integer.

Thus, the unique positive integer \( n \) for which \( S_n \) is an integer is \( n = 12 \).

The final answer is \( \boxed{12} \).