Added a generic LongNumber class, used it to simplify problem 13 and solve problem 16.