I am working with the following equation (parallel resistors):
$\frac{1}{R_g} = \frac{1}{R_1} + \frac{1}{R_2} + \frac{1}{R_3}$
The values of $R_1, R_2$ and $ R_3$ are discrete - lets say 256 steps in increments of 3: $$R_1,R_2,R_3 \in \{3n : 1 \leq n \leq 256\}$$
Given some $R_g \in \mathbb R$, I want to find the best of choice of $R_1, R_2$ and $R_3$ so that they come closest to the value $1/R_g$ as per the equation above. In other words, I want to minimize the following: $$\left| \frac 1 {R_1} + \frac 1 {R_2} + \frac 1 {R_3} - \frac 1 {R_g} \right|$$ My current solution is a look up table or calculating values on the fly until the error is small enough.
This sounds not very smart and I want to believe that there is a more intelligent solution.
Is there?