Resistor Color code calculator

And what are the various formulas that are applied depending on the inputs?