two solutions for euler10, though very slow