Yes, this is right regarding the equation.
In terms of the caching, there is nothing specific for phpBB, so you'll have to write something yourself; but this forum post should help you start: http://www.codecogs.com/pages/forums/pagegen.php?id=1764
Currently you need to be logged in to leave a message.