Look in the PBH for the xp charts, and base your formula on that. I forget the mathematical expression for adding consecutive numbers, although that would be a start.