I am having trouble with the following math problem. There is a variable "xp" that starts at 0. At xp of 0, the level is 1. At xp 500, the level is 2; at xp 1250 the level is 3; at xp 2250 the level is 4, and so on. 0 xp (lvl1) + 500 xp (lvl2) + 750 xp (lvl3) + 1000 xp (lvl4) + 1250 xp (lvl5) + 1500 xp (lvl6) etc...
So that means for level 6, you would need: 5000 xp. Each level adds the total amount of the previous level + 250. So level 3 is 500 (from level 2) plus (500+250), which makes 1250.
Therefore, what is the formula to determine the level for any xp value? And vice versa, how do we determine the xp for a certain level?
Since you know the number of points required to go up a level, you can construct the number of points for any level. This is tractable because the number of points required to level up form an arithmetic progression. This is one of the easier possibilities that you could have for this sequence.
Let $N_l$ be the number of points required to reach level $l$. You know that $N_1=0$ and the number of points to go from level $i$ to $i+1$ is $500+250(i-1)=250(i+1)$. You then have $$ N_l=N_1+\sum\limits_{i=1}^{l-1}(250(i+1))=250\sum\limits_{i=1}^{l-1}(i+1)=125(l-1)(l+2). $$ Verifying this for the first few levels $$\begin{aligned} N_1&=0\\ N_2&=500\\ N_3&=1250\\ N_4&=2250\\ N_5&=3500\\ N_6&=5000 \end{aligned}$$ shows that these agree with your calculations. This has the advantage of not requiring the knowledge of all levels up to the current one. As an example, I can say that the number of points required to get to level $100$ is $N_{100}=1262250$.