Ads project euler problem 001