f(3)     = 4


   f(f(3))  = f(4) = 8

To compute f(3), do a hand simulation, keeping track of the values of the variable.

    k    x
   ---  ---
    1    3
    2
    4
The loop keeps going as long as k is less than or equal to x. Each time, it doubles k. The loop ends when k > x.

To compute f(4), do another hand simulation.

    k    x
   ---  ---
    1    4
    2
    4
    8
Again, if k is less than or equal to x, the loop doubles k and goes to the top again.