Literally translate "Number Problem.cpp" to Python

It runs 33 times slower.