If a = b = 1 then f(k) is identically 1.<br>
<br>
If a = 1, b arbitrary, then f(3) = (1*b) mod (1+b), and f(4) = (b^2) mod (1+2b)<br>
That sequence seems at least through the first 10 or 11 terms to be
A123684.  If that's never 0, is it worth rephrasing the definition
to a and b are both integers greater than 1?<br>