C++ implementation of the Greek mathematician's algorithm.