why this sequence is $a_n=2n-1?$ 
Let postive integers sequence $\{a_n\}$,if for any postive integers $m$ we have
  $$\sum_{i=1}^{a_m}a_{i}=(2m-1)^2$$
  show that $$a_n=2n-1$$

It seem can use mathematical induction? Now only following 
$$\sum_{i=1}^{a_m} a_i-\sum_{i=1}^{a_{m-1}}a_i=a_{a_{m-1}+1}+a_{a_{m-1}+2}+\cdots+a_{a_m}$$Thanks in advance!
 A: First choose $m=1$ so :
$$a_1+\ldots+a_{a_1}=1$$ but the $a_i$'s are positive integers so it must be that $a_1=1$ .
The sequence in obviously one-to-one because if for some $i,j$ we have $a_i=a_j$ then the sums on the LHS are the same so $(2i-1)^2=(2j-1)^2$ which leads to $i=j$ .
The sequence is also strictly increasing because if $i>j$ then the sum on the $i$-LHS is bigger than the sum on the $j$-LHS so $a_i>a_j$ .As a corollary we get :
$$a_n \geq n$$ for every $n$ .
If $a_2=2$ then choose $m=2$ which leads to $a_1+a_2=9$ which is false .
Also if $a_2 \geq 4$ then putting $m=2$ we get :
$9 \geq a_1+a_2+a_3+a_4 \geq1+2+3+4=10$ ,false so $a_2=3$ .
Now assume that we established $a_i=2i-1$ for every $i$ between $1$ and $n$ .Denote $a_{n+1}=x$ .
Subtract the equations for $m=n$ and $m=n+1$ to get :
$$a_{2n}+\ldots+a_x=(2n+1)^2-(2n-1)^2=8n$$
with $x \geq 2n$ .
Assume that $x\geq 2n+2$ .Using the strictly increasing condition we get :
$a_{2n} \geq a_n+n=3n-1$ , $a_{2n+1} \geq 3n$ , $a_{2n+2} \geq 3n+1$ so plugging back :
$$8n \geq a_{2n}+a_{2n+1}+a_{2n+2} \geq 9n$$ clearly false .
So it must be that $x \leq 2n+1$ .
Now assume that $x=2n$ so $a_{2n}=8n$ .
Now use $m=2n$ and subtract it with $m=n$ :
$$(a_1+\ldots+a_{8n})-(a_1+\ldots+a_{2n-1})=(4n-1)^2-(2n-1)^2=4n(3n-1)$$
$$a_{2n}+\ldots+a_{8n}=4n(3n-1)$$ 
Use again the strictly increasing property to get :
$$a_{2n+d} \geq a_{2n}+d=8n+d$$ for every $d$ so plugging back we get :
$$4n(3n-1) \geq 8n+(8n+1)+\ldots+14n=11n(6n+1)$$ which is clearly false .
It follows that $a_{n+1}=x=2n+1$ and from the inductive hypothesis that $$a_n=2n-1$$ for every $n$ .
