Bloomberg Interview Question

Without using loops & counters, how do you solve this specific problem.