Solve euler28 in scala