Solution (A.P. problem):
Step 1: Recall formula for sum of $n$ terms of an A.P.
\[ S_n = \frac{n}{2}\left[2a+(n-1)d\right], \] where $a$ = first term and $d$ = common difference.
Step 2: Use given $S_7=49$
\[ 49=\frac{7}{2}\left[2a+6d\right] \ \Rightarrow \ 49=\frac{7}{2}(2a+6d). \] \[ \Rightarrow 2a+6d=14 \ \Rightarrow \ a+3d=7. \ \ \ (1) \]
Step 3: Use given $S_{17}=289$
\[ 289=\frac{17}{2}\left[2a+16d\right]. \] \[ \Rightarrow 2a+16d=\frac{289\times2}{17}=34. \ \ \ (2) \]
Step 4: Solve equations (1) and (2)
From (1): $a=7-3d$.
Substitute in (2): $2(7-3d)+16d=34$ $\Rightarrow$ $14-6d+16d=34 $$\Rightarrow$ $10d=20$ $\Rightarrow$$ d=2$.
Then $a=7-3(2)=1$.
Step 5: General formula for $S_n$
\[ S_n=\frac{n}{2}\left[2(1)+(n-1)(2)\right] =\frac{n}{2}\left[2+2n-2\right] =\frac{n}{2}(2n)=n^2. \] \[ \boxed{S_n=n^2} \]