[math-fun] reference for a simple algorithm