solve p005 (brute force; takes over 100sec)