This formula can be written in a C-based computer language (C, C++, C#, Java, etc.) as follows (minor things may need to be changed depending on the language, this is just pseudocode):
and in PHP (since a lot of RuneScapers seem to be familiar with PHP more than any other language... probably due to the software most fan-sites use):
The above formula works perfectly for levels 1 through 100 (and 102). However, on levels 101 through 120, there are some inaccuracies... levels 101, 103-110 and 113-120 are 1 XP too high, and levels 111 and 112 are 2 XP too high. I find this a bit strange mathematically, but I am hoping that if we do some work, we can come up with a new formula that is accurate for all levels. The following code will calculate 100% accurate experience for all levels 1 to 120, but it is not defined mathematically. It just checks to see if the levels are the problematic ones I just mentioned, and subtracts 1 or 2 XP as needed.
So let's see what we can do about creating an accurate formula!