C++ C++ Algorithm Number Algorithm