Looking for different approach for the question in projecteuler.net