$n = \sum_{r=1}^{\infty} a_r\pi^r$
The problem is $\pi^r \rightarrow \infty$ as $r \rightarrow \infty$. So you have 2 options. You can either define $a_r$ to be $0$ for $r >$ some natural number $n$. If you do that, then you can never achieve equality because that would be the equivalent of finding a polynomial which spits an algebraic number given $pi$, which is impossible, since the algebraic numbers are closed under polynomial arithmetic.
The second option is you can define $a_r$ to approach $0$ as $r \rightarrow \infty$. In that case, what your doing is taking equating the limit of a sequence to be an algebraic number. Given you can choose $a_r$ arbitrarily, then it's trivially possible, for example, just choose any rational number that returns $z \cdot 10^{-z}$ after being multiplied by $\pi^r$, where z is the $z^{th}$ digit to the right of the algebraic number's decimal point (doesn't matter what the remaining decimals are just ignore them), and adjust for the next rational number $a_{r+1}$. You don't need the $\pi^r$, infact you can achieve equality for any real number, not just algebraic numbers. Infinite sequences are neat that way.