How do I compute how many times can a mathematical operation be performed before the answer starts becoming negative or zero.
Specifically, I am looking for how many times can I perform $$\left\lfloor\frac{n-f}{s} + 1\right\rfloor$$ on $n$.
Where f,s,n are Whole Numbers and f<=n and s<=n This function is used to compute the output size of a convolution layer in Convolution Neural Networks used for Image Processing. So if I start with $n = 639$ and $f$ and $s$ as $3$ and $2$, respectively, I can go from $639$ to $319$ ($\lfloor(639-3)/2 + 1\rfloor$) to $159$ ($\lfloor(319-3)/2+1\rfloor$) to $79$ to $39$ to $19$ to $9$ to $4$ to $1$, after which I cannot perform $n-f$ anymore. So $f(639,3,2) = 8$ since I can perform this operation $8$ times.
Also curious to know if there is a mathematical term for how many times can I perform a particular operation?
You can figure this out inductively:
First, look at the case when you can only do it once, i.e. $\lfloor \frac{n - f}{s} + 1 \rfloor \leq 0$. That implies that $\frac{n - f}{s} + 1 < 1$, or in other words $n < f$.
Then consider the case when it takes two iterations. In that case, we know that $\lfloor \frac{n - f}{s} + 1 \rfloor < f$, since we need this iteration to return something that will satisfy the restriction above. This then becomes $\frac{n - f}{s} + 1 < f$, since $f$ is an integer, and we can reduce that to $n < f + s(f - 1)$.
Going to three iterations, we now have $\lfloor \frac{n - f}{s} + 1 \rfloor < f + s(f - 1)$, which we can rearrange to $n < f + s(f - 1) + s^2(f - 1)$.
At this point there's a pretty clear pattern: for $k$ iterations, the range that gets sent below zero is $n < f + s(f - 1) + s^2(f - 1) + \ldots + s^{k-1}(f - 1)$. We can simplify that using the formula for a geometric series, giving $n < f + s(f-1)\frac{s^k - 1}{s - 1}$.
Finally, we can take that and solve for $k$ if $f>1$:
$\begin{eqnarray} n & < & f + s(f - 1) \frac{s^k - 1}{f - 1} \\ \frac{s^k - 1}{s - 1} & > & \frac{n - f}{s(f - 1)} \\ s^k - 1 & > & \frac{(n - f)(s - 1)}{s(f - 1)} \\ k & > & \log_s \left( 1 + \frac{(n - f)(s - 1)}{s(f - 1)} \right) \end{eqnarray}$
and taking the ceiling of the right-hand side should give the correct value of $k$. Checking on your corner cases, we have:
$\begin{eqnarray} k(26, 5, 3) & = & \left\lceil \log_3 \left(1 + \frac{(26 - 5)(3 - 1)}{3(5-1)}\right) \right\rceil \\ & = & \left\lceil \log_3 (4.5) \right\rceil \\ & = & 2 \\ k(4, 4, 2) & = & \left\lceil \log_2 \left(1 + \frac{(4 - 4)(2 - 1)}{2(2 - 1)} \right) \right\rceil \\ & = & \lceil \log_2 (1.5) \rceil \\ & = & 1 \end{eqnarray}$
so at least on those values we're getting your expected answer.