solution to problem 18 in python
- will need to revisit as this solution is too slow for problem 67