If my computation is correct, then f(n, 2) should be roughly
$$\frac12 \sum_{k \in \mathbb{Z}} 2^{k+s} e^{-2^{k+s}}$$
where s = the fractional part of $\log_2 n$. (Note the terms of the sum decay rapidly both as $k \to \infty$ and $k \to -\infty$.)
I have to run. Does that look anything like the computational results?