Implementing a programmable variable resistor
A series combination of power-of-two resistors will accomplish what you want, though with n resistor values of n resistors for n bits. 

So 20 resistor values will give you from 1 ohm to 1.048575 Megohm in steps of 1 ohm (however it will surely not be monotonic!). The n'th resistor from 0 to 19 would be \$2^n\Omega\$, so 1\$\Omega\$, 2\$\Omega\$, 4\$\Omega\$, 8\$\Omega\$, 16\$\Omega\$,.., 524288\$\Omega\$

More sensibly, for some applications, decade switches in series with resistors of 1,2,4,8 ohms. 6 of them (24 resistors) would allow you to cover the same range with decimal numbers rather than binary. So the 2nd decade would be 10, 20, 40, 80 and so on. 

You have long been able to buy "decade boxes" that perform this function. I have one that is (even) older than myself and is still very accurate because the resistors are made with low strain wirewound forms and cast in wax.