solved euler29.py with brute force