Supose that n has L digits, we used $d_0, d_1, d_2, \ldots, d_{L-1}$ to indicate every digit of n from least significant digit to most significant one.
$f(n, k) = \sum\limits_{i=0}^{L-1}d_i^k$, for example $f(305, 2) = 5^2 + 3^2 + 0^2 = 34$
We are curious about that for each x ranged from a to b($a \leq b$), how many integers make $S=f(x, k)$ (here S is a constant) true.