problem 25, brute force'd