solution for problems on ProjectEuler