public string SolveEfficient() { // efficient O(1) technique const int max = 999; // max variable is captured by the sumDivisibleBy closure Func <int, int> sumDivisibleBy = divisor => Maths.ArithmeticSeries(divisor, divisor, (max / divisor)); var sum = sumDivisibleBy(3) + sumDivisibleBy(5) - sumDivisibleBy(15); return(sum.ToString()); }