Basic Maths, Binary search.
You need to find all x for given y such that f(x)=y.
Let us consider a number x. And suppose that we divide it by two exactly ‘a’ times, and then we would be left with some number ‘b’.
Then the result would be (b*(b-1))/2 + b*((2^a)-1).
As this equation is increasing for a fixed ‘a’ we can use binary search over ‘b’ to get values.
This can be also solved by finding solutions of above quadratic equation.