I have a complicated looking expression involving two naturals numbers $n,k$ where $n\ge k\ge 3$: $f(n,k)=2^{k-2}(2n-k+1)\big(\big\lfloor\tfrac{n}{k-1}\big\rfloor-1\big)+(1-k)2^{k-3}\Big(\big\lfloor\tfrac{n}{k-1}\big\rfloor\big(\big\lfloor\tfrac{n}{k-1}\big\rfloor+1\big)-2\Big)-(n-k+1)\Big(\big\lfloor\tfrac{n}{k-1}\big\rfloor-2\Big).$ I wish to find a good upper bound $f(n,k)\le g(n,k)$ such that $g(n,k)=1$ can be solved for $n$. The problem is the floor of the first function on the right hand side can be easily eliminated but because the second/third term may be negative the same cannot be done for the whole $f(n,k)$.
Basically my question is how do I get an upper bound?
Thanks