Project euler: problems 14, 15, 16 solved.