I have a C program that does the following calculation:
int b = 16;
int a = max(1, ( (b + 3) / 4 ) ) * max(1, ( (b + 3) / 4 ) ) * 16;
More easily read as: $$ a = \max\left(1, \frac{b + 3}{4}\right)^2 × 16 $$
I would like to know how I could use simple algebra in order to find what is the equivalent algorithm to find the value of b if I am only given the value of a? For example:
int a = 256;
int b = ?
To say it another way, the range of the function on the RHS is $a \ge 16$ (plot $a$ against $b$ if you don't see it.) There are three cases:
if $a \lt 16$, it is not in the range, so there is no $b$ that can produce that value.
if $a = 16$, then $\max(1, (b+3)/4) = 1$ and any $b$ where $(b+3)/4 \le 1$ will do.
if $a \gt 16$ then there is a unique $b = 4\sqrt{a/16} - 3 = \sqrt{a} - 3$ that produces that $a$ (assuming you want the positive square root only).