Cleaned up and commented code. Happy to say for large numbers my code is fantastic and much better than brute force. At lower numbers it still does well.