Problem 51 - partial solution

Takes 17-20 seconds to calculate max for five digits